[vlc-devel] opencv4_patches opencv_wrapper

w.pelser w.pelser at web.de
Wed Sep 25 09:56:26 CEST 2019


(This is an additional mail, as the original is lost and I want to
answer again)

Hi Steve!

Today I found out, that the patched opencv_wrapper.c, renamed to
opencv_wrapper.cpp is also working with opencv3. My conclusion is, that
opencv_wrapper.c is obsolete and should be replaced by
opencv_wrapper.cpp. Please check the code-changes before.

thanks

walther




Hi,

On 2019-09-23 11:55, w.pelser wrote:
 >
 >
 >
 >
 >
 >
 >
 >
 >
 > VLC and vlc-dev are not compatible with opencv4.
 >
 > - video_filter/opencv_example.cpp should be rewritten or excluded. It
 > seems to require objectdetect_c.h, which is not longer part of opencv.
 >
 > - video_filter/opencv_wrapper.c needes to be converted to a cpp file, to
 > enable cplusplus a.o.
 >
 > So I tried to do this with the help of the opencv_example.cpp file. My
 > knowledge is very smal, but the following patches do not break my
 > vlc-dev (git/videolan/vlc_branch_master) build anymore.
 >
 > opencv_wrapper_cpp.patch:
 >
 > --- a/modules/video_filter/opencv_wrapper.c
 > +++ b/modules/video_filter/opencv_wrapper.c
 > @@ -154 +154 @@
 > -    p_sys = malloc( sizeof( filter_sys_t ) );
 > +    p_sys = (filter_sys_t *)malloc(sizeof (filter_sys_t));
 > @@ -167 +167 @@
 > -    p_sys->p_opencv = vlc_object_create( p_filter, sizeof(filter_t) );
 > +    p_sys->p_opencv = (filter_t*) vlc_object_create( p_filter,
 > sizeof(filter_t) );
 > @@ -266 +266 @@
 > -    filter_sys_t *p_sys = p_filter->p_sys;
 > +    filter_sys_t *p_sys = static_cast<filter_sys_t *>(p_filter->p_sys);
 > @@ -281 +281 @@
 > -    filter_sys_t* p_sys = p_filter->p_sys;
 > +    filter_sys_t *p_sys = static_cast<filter_sys_t *>(p_filter->p_sys);
 > @@ -317 +317 @@
 > -    filter_sys_t* p_sys = p_filter->p_sys;
 > +    filter_sys_t *p_sys = static_cast<filter_sys_t *>(p_filter->p_sys);
 > @@ -402 +402 @@
 > -    filter_sys_t *p_sys = p_filter->p_sys;
 > +    filter_sys_t *p_sys = static_cast<filter_sys_t *>(p_filter->p_sys);
 >
 >
 > configure_ac.patch:
 >
 > --- a/configure.ac
 > +++ b/configure.ac
 > @@ -2017 +2017 @@
 > -PKG_ENABLE_MODULES_VLC([OPENCV], [opencv_example opencv_wrapper],
 > [opencv > 2.0], (OpenCV (computer vision) filter), [auto])
 > +PKG_ENABLE_MODULES_VLC([OPENCV], [opencv_example opencv_wrapper],
 > [opencv4], (OpenCV (computer vision) filter), [auto])
 >
 >
 > video_filter_makefile_am.patch:
 >
 > --- a/modules/video_filter/Makefile.am
 > +++ b/modules/video_filter/Makefile.am
 > @@ -157 +157 @@ cpp-Version
 > -libopencv_wrapper_plugin_la_SOURCES = video_filter/opencv_wrapper.c
 > +libopencv_wrapper_plugin_la_SOURCES = video_filter/opencv_wrapper.cpp

It seems that you didn't rename the file in your patch so it shouldn't
compile.

Yes, I renamed patched opencv_wrapper.c to opencv_wrapper.cpp. During build opencv_wrapper.c is buils as CC, opencv_wrapper.cpp is build as CXX. That's the point for me.


As for C++ do you need it for linking ? Or do the API not work with C
anymore ? In the former case you can just add dummy.cpp to you project
and it will trigger the C++ handling of autotools.

The API does not work anymore with CC. Seehttps://trac.videolan.org/vlc/ticket/22016  and the include lines always produce lots of fatal errors during build as CC.
My OS is openSUSE Tumbleweed, where opencv4 has become the default opencv-version. since then the trouble began. opencv3 is at its end and not developed further.


 > @@ -175,6+175,6 @@ objdetect_c.h missing, not provided by opencv4
 > -libopencv_example_plugin_la_SOURCES = video_filter/opencv_example.cpp
 > video_filter/filter_event_info.h
 > -libopencv_example_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) $(OPENCV_CFLAGS)
 > -libopencv_example_plugin_la_LIBADD = $(OPENCV_LIBS)
 > -libopencv_example_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath
 > '$(video_filterdir)'
 > -video_filter_LTLIBRARIES += $(LTLIBopencv_example)
 > -EXTRA_LTLIBRARIES += libopencv_example_plugin.la
 > +#libopencv_example_plugin_la_SOURCES = video_filter/opencv_example.cpp
 > video_filter/filter_event_info.h
 > +#libopencv_example_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) $(OPENCV_CFLAGS)
 > +#libopencv_example_plugin_la_LIBADD = $(OPENCV_LIBS)
 > +#libopencv_example_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath
 > '$(video_filterdir)'
 > +#video_filter_LTLIBRARIES += $(LTLIBopencv_example)
 > +#EXTRA_LTLIBRARIES += libopencv_example_plugin.la
 >
 > In the hope, this could be helpful,
 >
 > thanks
 >
 > walther
 >
 >
 >
 >
 > _______________________________________________

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190925/f9fb85fa/attachment.html>


More information about the vlc-devel mailing list