rgbd
tools
tools/view.cpp
Go to the documentation of this file.
1
#include <
rgbd/serialization.h
>
2
#include <
rgbd/image.h
>
3
4
#include <
fstream
>
5
6
#include <opencv2/highgui/highgui.hpp>
7
8
int
main
(
int
argc,
char
**argv) {
9
10
if
(argc != 2)
11
{
12
std::cout
<<
"Usage:\n\n view FILENAME\n\n"
;
13
return
1;
14
}
15
16
// read
17
std::ifstream
f_in;
18
f_in.
open
(argv[1], std::ifstream::binary);
19
20
if
(!f_in.
is_open
())
21
{
22
std::cout
<<
"Could not open '"
<< argv[1] <<
"'."
<<
std::endl
;
23
return
1;
24
}
25
26
tue::serialization::InputArchive
a_in(f_in);
27
28
rgbd::Image
image;
29
rgbd::deserialize
(a_in, image);
30
31
std::cout
<<
"Image loaded from disk."
<<
std::endl
;
32
std::cout
<<
" name: "
<< argv[1] <<
std::endl
;
33
// std::cout << " size: " << image.getWidth() << " x " << image.getHeight() << std::endl;
34
std::cout
<<
" frame: "
<< image.
getFrameId
() <<
std::endl
;
35
std::cout
<<
" time: "
<< ros::Time(image.
getTimestamp
()) <<
std::endl
;
36
37
cv::imshow(
"rgb"
, image.
getRGBImage
());
38
cv::imshow(
"depth"
, image.
getDepthImage
() / 8);
39
cv::waitKey();
40
41
return
0;
42
}
fstream
rgbd::Image::getDepthImage
const cv::Mat & getDepthImage() const
Get the depth image.
Definition:
image.h:72
rgbd::Image::getTimestamp
double getTimestamp() const
Get the timestamp.
Definition:
image.h:90
rgbd::deserialize
bool deserialize(tue::serialization::InputArchive &a, Image &image)
Definition:
serialization.cpp:174
main
int main(int argc, char **argv)
Definition:
tools/view.cpp:8
std::cout
rgbd::Image
Definition:
image.h:43
std::ifstream::open
T open(T... args)
image.h
rgbd::Image::getRGBImage
const cv::Mat & getRGBImage() const
Get the RGB color image.
Definition:
image.h:78
tue::serialization::InputArchive
std::endl
T endl(T... args)
rgbd::Image::getFrameId
const std::string & getFrameId() const
Get the frame_id.
Definition:
image.h:84
serialization.h
std::ifstream::is_open
T is_open(T... args)
std::ifstream
Generated on Sun Feb 23 2025 04:34:32 for rgbd by
1.8.17