Skip to content

Commit

Permalink
add OpenCV includes for the vpConfig.h refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
SamFlt committed Oct 25, 2023
1 parent b1ee149 commit 9eff5ed
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
8 changes: 6 additions & 2 deletions core/sample-vpImageConvert-6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@
#include <visp3/core/vpImageConvert.h>
#include <visp3/io/vpImageIo.h>

#if defined(HAVE_OPENCV_IMGCODECS)
#include <opencv2/imgcodecs.hpp>
#endif

int main()
{
#if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100)
#if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100) && defined(HAVE_OPENCV_IMGCODECS)
vpImage<unsigned char> Ig; // A greyscale image
cv::Mat Ip;

// Read an image on a disk
vpImageIo::readPGM(Ig, "image.pgm");
// Convert the vpImage<unsigned char> in to greyscale cv::Mat
vpImageConvert::convert(Ig, Ip);
// Treatments on cv::MatIp
// Treatments on cv::Mat Ip
//...
// Save the cv::Mat on the disk
cv::imwrite("image.pgm", Ip);
Expand Down
6 changes: 5 additions & 1 deletion core/sample-vpImageConvert-7.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
#include <visp3/core/vpImageConvert.h>
#include <visp3/io/vpImageIo.h>

#if defined(HAVE_OPENCV_IMGCODECS)
#include <opencv2/imgcodecs.hpp>
#endif

int main()
{
#if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100)
#if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100) && defined(HAVE_OPENCV_IMGCODECS)
vpImage<unsigned char> Ig; // A greyscale image
cv::Mat Ip;

Expand Down
6 changes: 5 additions & 1 deletion core/sample-vpImageConvert-8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
#include <visp3/core/vpImageConvert.h>
#include <visp3/io/vpImageIo.h>

#if defined(HAVE_OPENCV_IMGCODECS)
#include <opencv2/imgcodecs.hpp>
#endif

int main()
{
#if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100)
#if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100) && defined(HAVE_OPENCV_IMGCODECS)
vpImage<unsigned char> Ig; // A grayscale image
cv::Mat Ip;

Expand Down
7 changes: 6 additions & 1 deletion core/sample-vpImageConvert-9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
#include <visp3/core/vpImageConvert.h>
#include <visp3/io/vpImageIo.h>


#if defined(HAVE_OPENCV_IMGCODECS)
#include <opencv2/imgcodecs.hpp>
#endif

int main()
{
#if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100)
#if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100) && defined(HAVE_OPENCV_IMGCODECS)
vpImage<vpRGBa> Ic; // A color image
cv::Mat Ip;

Expand Down

0 comments on commit 9eff5ed

Please sign in to comment.