<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p> </p>
    <h1>[vlc-devel] opencv4_patches opencv_wrapper</h1>
    <b>Steve Lhomme</b> <a
href="mailto:vlc-devel%40videolan.org?Subject=Re%3A%20%5Bvlc-devel%5D%20opencv4_patches%20opencv_wrapper&In-Reply-To=%3C5a2b66e4-ffd5-e85f-855b-76f6b19236ba%40ycbcr.xyz%3E"
      title="[vlc-devel] opencv4_patches opencv_wrapper">robux4 at
      ycbcr.xyz </a><br>
    <i>Mon Sep 23 12:48:30 CEST 2019</i>
    <ul>
      <li>Previous message (by thread): <a
href="https://mailman.videolan.org/pipermail/vlc-devel/2019-September/127618.html">[vlc-devel]
          opencv4_patches opencv_wrapper
        </a></li>
      <li> <b>Messages sorted by:</b> <a
href="https://mailman.videolan.org/pipermail/vlc-devel/2019-September/date.html#127621">[
          date ]</a> <a
href="https://mailman.videolan.org/pipermail/vlc-devel/2019-September/thread.html#127621">[
          thread ]</a> <a
href="https://mailman.videolan.org/pipermail/vlc-devel/2019-September/subject.html#127621">[
          subject ]</a> <a
href="https://mailman.videolan.org/pipermail/vlc-devel/2019-September/author.html#127621">[
          author ]</a> </li>
    </ul>
    <hr>
    <pre>Hi,

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



><i> @@ -175,6+175,6 @@ objdetect_c.h missing, not provided by opencv4
</i>><i> -libopencv_example_plugin_la_SOURCES = video_filter/opencv_example.cpp
</i>><i> video_filter/filter_event_info.h
</i>><i> -libopencv_example_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) $(OPENCV_CFLAGS)
</i>><i> -libopencv_example_plugin_la_LIBADD = $(OPENCV_LIBS)
</i>><i> -libopencv_example_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath
</i>><i> '$(video_filterdir)'
</i>><i> -video_filter_LTLIBRARIES += $(LTLIBopencv_example)
</i>><i> -EXTRA_LTLIBRARIES += libopencv_example_plugin.la
</i>><i> +#libopencv_example_plugin_la_SOURCES = video_filter/opencv_example.cpp
</i>><i> video_filter/filter_event_info.h
</i>><i> +#libopencv_example_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) $(OPENCV_CFLAGS)
</i>><i> +#libopencv_example_plugin_la_LIBADD = $(OPENCV_LIBS)
</i>><i> +#libopencv_example_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath
</i>><i> '$(video_filterdir)'
</i>><i> +#video_filter_LTLIBRARIES += $(LTLIBopencv_example)
</i>><i> +#EXTRA_LTLIBRARIES += libopencv_example_plugin.la
</i>><i>
</i>><i> In the hope, this could be helpful,
</i>><i>
</i>><i> thanks
</i>><i>
</i>><i> walther
</i>><i>
</i>><i>
</i>><i>
</i>><i>
</i>><i> _______________________________________________
</i>><i> vlc-devel mailing list
</i>><i> To unsubscribe or modify your subscription options:
</i>><i> <a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a>
</i>><i>
</i></pre>
    <hr>
    <ul>
      <li>Previous message (by thread): <a
href="https://mailman.videolan.org/pipermail/vlc-devel/2019-September/127618.html">[vlc-devel]
          opencv4_patches opencv_wrapper
        </a></li>
      <li> <b>Messages sorted by:</b> <a
href="https://mailman.videolan.org/pipermail/vlc-devel/2019-September/date.html#127621">[
          date ]</a> <a
href="https://mailman.videolan.org/pipermail/vlc-devel/2019-September/thread.html#127621">[
          thread ]</a> <a
href="https://mailman.videolan.org/pipermail/vlc-devel/2019-September/subject.html#127621">[
          subject ]</a> <a
href="https://mailman.videolan.org/pipermail/vlc-devel/2019-September/author.html#127621">[
          author ]</a> </li>
    </ul>
    <hr>
    <a href="https://mailman.videolan.org/listinfo/vlc-devel">More
      information about the vlc-devel
      mailing list</a><br>
  </body>
</html>