41#include "vpImageIoBackend.h"
43#ifdef VISP_HAVE_OPENCV
44#if (VISP_HAVE_OPENCV_VERSION >= 0x030000)
45# include <opencv2/imgcodecs.hpp>
46#elif (VISP_HAVE_OPENCV_VERSION >= 0x020408)
47# include <opencv2/core/core.hpp>
48# include <opencv2/highgui/highgui.hpp>
49# include <opencv2/imgproc/imgproc.hpp>
50#elif (VISP_HAVE_OPENCV_VERSION >= 0x020101)
51# include <opencv2/core/core.hpp>
52# include <opencv2/highgui/highgui.hpp>
53# include <opencv2/highgui/highgui_c.h>
54# include <opencv2/legacy/legacy.hpp>
60#include <visp3/core/vpImageConvert.h>
63#if defined(VISP_HAVE_OPENCV)
82#if defined(VISP_HAVE_OPENCV) && VISP_HAVE_OPENCV_VERSION >= 0x020100
83#if VISP_HAVE_OPENCV_VERSION >= 0x030200
84 int flags = cv::IMREAD_GRAYSCALE | cv::IMREAD_IGNORE_ORIENTATION;
85#elif VISP_HAVE_OPENCV_VERSION >= 0x030000
86 int flags = cv::IMREAD_GRAYSCALE;
87#elif VISP_HAVE_OPENCV_VERSION >= 0x020100
88 int flags = CV_LOAD_IMAGE_GRAYSCALE;
90 cv::Mat Ip = cv::imread(filename.c_str(), flags);
97 Ip = cvLoadImage(filename.c_str(), CV_LOAD_IMAGE_GRAYSCALE);
125#if defined(VISP_HAVE_OPENCV) && VISP_HAVE_OPENCV_VERSION >= 0x020100
126#if VISP_HAVE_OPENCV_VERSION >= 0x030200
127 int flags = cv::IMREAD_COLOR | cv::IMREAD_IGNORE_ORIENTATION;
128#elif VISP_HAVE_OPENCV_VERSION >= 0x030000
129 int flags = cv::IMREAD_COLOR;
130#elif VISP_HAVE_OPENCV_VERSION >= 0x020100
131 int flags = CV_LOAD_IMAGE_COLOR;
133 cv::Mat Ip = cv::imread(filename.c_str(), flags);
140 Ip = cvLoadImage(filename.c_str(), CV_LOAD_IMAGE_COLOR);
158#if (VISP_HAVE_OPENCV_VERSION >= 0x020408)
162 std::vector<int> compression_params;
163 compression_params.push_back(cv::IMWRITE_JPEG_QUALITY);
164 compression_params.push_back(quality);
165 cv::imwrite(filename.c_str(), Ip, compression_params);
170 cvSaveImage(filename.c_str(), Ip);
184void writeOpenCV(
const vpImage<vpRGBa> &I,
const std::string &filename,
int quality)
186#if (VISP_HAVE_OPENCV_VERSION >= 0x020408)
190 std::vector<int> compression_params;
191 compression_params.push_back(cv::IMWRITE_JPEG_QUALITY);
192 compression_params.push_back(quality);
193 cv::imwrite(filename.c_str(), Ip, compression_params);
198 cvSaveImage(filename.c_str(), Ip);
static void convert(const vpImage< unsigned char > &src, vpImage< vpRGBa > &dest)
Error that can be emited by the vpImage class and its derivates.