Opened 5 years ago

Closed 5 years ago

#323 closed enhancement (needs_more_info)

[patch] properly detect and compile with opencv 2.2+

Reported by: mm Owned by:
Priority: normal Component: avfilter
Version: unspecified Keywords: opencv
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


For libavfilter/vf_libopencv.c starting with OpenCV version 2.2 only the opencv_core and opencv_imgproc headers and libraries are required. Example patch below adds proper support for this case. This is relevant for master and oldabi.

diff --git a/configure b/configure
index fd4b034..ea74df3 100755
--- a/configure
+++ b/configure
@@ -2900,6 +2900,8 @@ enabled libnut     && require  libnut libnut.h nut_demuxer_init -lnut
 enabled libopencore_amrnb  && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
 enabled libopencore_amrwb  && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
 enabled libopencv  && require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader
+enabled libopencv  && check_pkg_config opencv opencv2/imgproc/imgproc_c.h cvCreateImageHeader && add_cflags -DHAVE_OPENCV2 ||
+			require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader
 enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
 enabled librtmp    && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
 enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
diff --git a/libavfilter/vf_libopencv.c b/libavfilter/vf_libopencv.c
index e1b51c5..f22b2bc 100644
--- a/libavfilter/vf_libopencv.c
+++ b/libavfilter/vf_libopencv.c
@@ -25,8 +25,13 @@
 /* #define DEBUG */
+#ifdef HAVE_OPENCV2
+#include <opencv2/core/core_c.h>
+#include <opencv2/imgproc/imgproc_c.h>
 #include <opencv/cv.h>
 #include <opencv/cxcore.h>
 #include "libavutil/avstring.h"
 #include "libavutil/file.h"
 #include "avfilter.h"

Change History (2)

comment:1 Changed 5 years ago by cehoyos

  • Status changed from new to open

Could you explain which problem your patch fixes?

comment:2 Changed 5 years ago by michael

  • Resolution set to needs_more_info
  • Status changed from open to closed

Please reopen the ticket once somone explains what this patch fixes

Note: See TracTickets for help on using tickets.