ViSP  2.9.0
tutorial-image-converter.cpp
1 
2 #include <visp/vpImageIo.h>
3 #include <visp/vpImageConvert.h>
4 
5 int main()
6 {
7 #if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100)
8  try {
9  cv::Mat A;
10  A = cv::imread("lena.bmp", CV_LOAD_IMAGE_GRAYSCALE);
11 
14 
15 # ifdef VISP_HAVE_LIBPNG
16  vpImageIo::write(I, "lena.png"); // Gray
17 # endif
18  }
19  catch(vpException e) {
20  std::cout << "Catch an exception: " << e << std::endl;
21  }
22 #endif
23 }
static void write(const vpImage< unsigned char > &I, const char *filename)
Definition: vpImageIo.cpp:452
static void convert(const vpImage< unsigned char > &src, vpImage< vpRGBa > &dest)
error that can be emited by ViSP classes.
Definition: vpException.h:76