[vlc-devel] opencv4_patches opencv_wrapper

Steve Lhomme robux4 at ycbcr.xyz
Mon Sep 23 12:48:30 CEST 2019


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.

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.

> @@ -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
> 
> 
> 
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
> 


More information about the vlc-devel mailing list