Visual Servoing Platform  version 3.2.0
tutorial-image-converter.cpp
#include <visp3/core/vpImageConvert.h>
#include <visp3/io/vpImageIo.h>
int main()
{
#if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100)
try {
cv::Mat A;
#if (VISP_HAVE_OPENCV_VERSION >= 0x030000)
A = cv::imread("monkey.bmp", cv::IMREAD_GRAYSCALE);
#else
A = cv::imread("monkey.bmp", CV_LOAD_IMAGE_GRAYSCALE);
#endif
#ifdef VISP_HAVE_PNG
vpImageIo::write(I, "monkey.png"); // Gray
#endif
} catch (const vpException &e) {
std::cout << "Catch an exception: " << e << std::endl;
}
#endif
}
vpImageConvert::convert
static void convert(const vpImage< unsigned char > &src, vpImage< vpRGBa > &dest)
Definition: vpImageConvert.cpp:78
vpImageIo::write
static void write(const vpImage< unsigned char > &I, const std::string &filename)
Definition: vpImageIo.cpp:374
vpImage< unsigned char >
vpException
error that can be emited by ViSP classes.
Definition: vpException.h:70