Skip to content

Commit

Permalink
Another fix for old and new OpenCV
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyAB committed Apr 8, 2019
1 parent 199b886 commit 5a094da
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/image_opencv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,22 @@

#include <opencv2/highgui/highgui.hpp>
#include <opencv2/video/video.hpp>

// includes for OpenCV >= 3.x
#ifndef CV_VERSION_EPOCH
#include <opencv2/core/types.hpp>
#include <opencv2/videoio/videoio.hpp>
#include <opencv2/imgcodecs/imgcodecs.hpp>
#endif

// OpenCV includes for OpenCV 2.x
#ifdef CV_VERSION_EPOCH
#include <opencv2/highgui/highgui_c.h>
#include <opencv2/imgproc/imgproc_c.h>
#include <opencv2/core/types_c.h>
#include <opencv2/core/version.hpp>
#endif

using namespace cv;

using std::cerr;
Expand All @@ -44,15 +54,7 @@ using std::endl;
#endif // USE_CMAKE_LIBS
#endif // CV_VERSION_EPOCH

// OpenCV includes
#include <opencv2/highgui/highgui_c.h>
#include <opencv2/imgproc/imgproc_c.h>
#include <opencv2/core/types_c.h>
#include <opencv2/core/version.hpp>
#ifndef CV_VERSION_EPOCH
//#include <opencv2/videoio/videoio_c.h>
//#include <opencv2/imgcodecs/imgcodecs_c.h>
#endif


#include "http_stream.h"

Expand Down Expand Up @@ -447,7 +449,11 @@ write_cv *create_video_writer(char *out_filename, char c1, char c2, char c3, cha
{
try {
cv::VideoWriter * output_video_writer =
#ifdef CV_VERSION_EPOCH
new cv::VideoWriter(out_filename, CV_FOURCC(c1, c2, c3, c4), fps, cv::Size(width, height), is_color);
#else
new cv::VideoWriter(out_filename, cv::VideoWriter::fourcc(c1, c2, c3, c4), fps, cv::Size(width, height), is_color);
#endif

return (write_cv *)output_video_writer;
}
Expand Down

0 comments on commit 5a094da

Please sign in to comment.