Open ansarid opened 3 years ago
Hey, it was written for OpenCV 3.10 so maybe try that version?
It is looking for OpenCV COMPONENTS core imgproc highgui videoio
So make sure they are all included too
@jacksonliam I ran sudo apt install libopencv-core-dev libopencv-videoio-dev libopencv-highgui-dev libopencv-imgproc-dev
and all those packages are already installed but they are for opencv version 3.2.0. I'm having a difficult time finding a package for opencv 3.1.* for a Raspberry Pi. I'll see if I can figure that part out though.
I can't get de input_opencv.so too. I make for opencv4.11, it that problem? it work only in opencv 3.10?
I'm having exactly the same issue as OP, and I can't figure out how to install version 3.1. Any news or workarounds? Thanks!
I found the solution. Please see the workaround below, cannot guarantee it will not cause any problems since mjp-streamer is written for OpenCV 3.X. Basically, the CMakefile checks if OpenCV major version equals 3 and ignore the plugin if it is anything other than OpenCV 3.X.
Edit file plugins/input_opencv/CMakeLists.txt
Change MJPG_STREAMER_PLUGIN_OPTION(input_opencv "OpenCV input plugin" ONLYIF OpenCV_FOUND ${OpenCV_VERSION_MAJOR} EQUAL 3)
To MJPG_STREAMER_PLUGIN_OPTION(input_opencv "OpenCV input plugin")
Similarly, edit file plugins/input_opencv/filters/cvfilter_py/CMakeLists.txt
and remove the logic of checking if OpenCV major version number EQUALS 3.
Change MJPG_STREAMER_PLUGIN_OPTION(cvfilter_py "OpenCV Python filter" ONLYIF OpenCV_FOUND ${OpenCV_VERSION_MAJOR} EQUAL 3)
To MJPG_STREAMER_PLUGIN_OPTION(cvfilter_py "OpenCV Python filter")
make again and you should see it is enabled.
Or just fork this guy's fork https://github.com/lzmlzm/mjpg-streamer
I notice that OP might have an older version of OpenCV installed, and also pip installed OpenCV. This could cause conflicts. Try to remove the older copy and make again.
@j0e1an I finally had the time to test out this solution and I was able to get my OpenCV plugin successfully working without any issues! Thank you!
I've been unable to satisfy the cmake requirements needed to compile input_opencv.so during the
make
andmake install
process. Unsure if I'm missing something simple or if there is a legitimate issue that needs to be tackled. Either way I've spent a lot of time trying to make this work and been unsuccessful.Steps to Reproduce:
Platform: Raspberry Pi 3 Model B+ OS: Raspberry Pi OS Lite
Download and Flash Raspberry Pi OS Lite to a microSD card. Setup WiFi, SSH, etc.
Update and Upgrade:
Install Dependencies:
Clone mjpg-streamer:
Compile:
Output:
-- The following OPTIONAL packages have been found:
-- The following features have been disabled:
-- Configuring done -- Generating done -- Build files have been written to: /home/pi/mjpg-streamer/mjpg-streamer-experimental/_build make -C _build make[1]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' make[2]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' Scanning dependencies of target mjpg_streamer make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 3%] Building C object CMakeFiles/mjpg_streamer.dir/mjpg_streamer.c.o [ 6%] Building C object CMakeFiles/mjpg_streamer.dir/utils.c.o [ 10%] Linking C executable mjpg_streamer make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 10%] Built target mjpg_streamer make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' Scanning dependencies of target input_file make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 13%] Building C object plugins/input_file/CMakeFiles/input_file.dir/input_file.c.o [ 17%] Linking C shared library input_file.so make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 17%] Built target input_file make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' Scanning dependencies of target input_http make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 20%] Building C object plugins/input_http/CMakeFiles/input_http.dir/input_http.c.o [ 24%] Building C object plugins/input_http/CMakeFiles/input_http.dir/misc.c.o [ 27%] Building C object plugins/input_http/CMakeFiles/input_http.dir/mjpg-proxy.c.o [ 31%] Linking C shared library input_http.so make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 31%] Built target input_http make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' Scanning dependencies of target input_raspicam make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 34%] Building C object plugins/input_raspicam/CMakeFiles/input_raspicam.dir/input_raspicam.c.o In file included from /home/pi/mjpg-streamer/mjpg-streamer-experimental/plugins/input_raspicam/input_raspicam.c:51: /home/pi/mjpg-streamer/mjpg-streamer-experimental/plugins/input_raspicam/RaspiCamControl.c: In function ‘raspicamcontrol_set_saturation’: /home/pi/mjpg-streamer/mjpg-streamer-experimental/plugins/input_raspicam/RaspiCamControl.c:762:32: warning: implicit declaration of function ‘mmal_port_parameter_set_rational’; did you mean ‘mmal_port_parameter_set’? [-Wimplicit-function-declaration] ret = mmal_status_to_int(mmal_port_parameter_set_rational(camera->control, MMAL_PARAMETER_SATURATION, value)); ^
~~~~~~~ mmal_port_parameter_set /home/pi/mjpg-streamer/mjpg-streamer-experimental/plugins/input_raspicam/RaspiCamControl.c: In function ‘raspicamcontrol_set_ISO’: /home/pi/mjpg-streamer/mjpg-streamer-experimental/plugins/input_raspicam/RaspiCamControl.c:864:30: warning: implicit declaration of function ‘mmal_port_parameter_set_uint32’; did you mean ‘mmal_port_parameter_set’? [-Wimplicit-function-declaration] return mmal_status_to_int(mmal_port_parameter_set_uint32(camera->control, MMAL_PARAMETER_ISO, ISO)); ^~~~~~~~~~ mmal_port_parameter_set /home/pi/mjpg-streamer/mjpg-streamer-experimental/plugins/input_raspicam/RaspiCamControl.c: In function ‘raspicamcontrol_set_video_stabilisation’: /home/pi/mjpg-streamer/mjpg-streamer-experimental/plugins/input_raspicam/RaspiCamControl.c:899:30: warning: implicit declaration of function ‘mmal_port_parameter_set_boolean’; did you mean ‘mmal_port_parameter_set’? [-Wimplicit-function-declaration] return mmal_status_to_int(mmal_port_parameter_set_boolean(camera->control, MMAL_PARAMETER_VIDEO_STABILISATION, vstabilisation)); ^~~~~~~mmal_port_parameter_set /home/pi/mjpg-streamer/mjpg-streamer-experimental/plugins/input_raspicam/RaspiCamControl.c: In function ‘raspicamcontrol_set_exposure_compensation’: /home/pi/mjpg-streamer/mjpg-streamer-experimental/plugins/input_raspicam/RaspiCamControl.c:913:30: warning: implicit declaration of function ‘mmal_port_parameter_set_int32’; did you mean ‘mmal_port_parameter_set’? [-Wimplicit-function-declaration] return mmal_status_to_int(mmal_port_parameter_set_int32(camera->control, MMAL_PARAMETER_EXPOSURE_COMP , exp_comp)); ^~~~~~~~~ mmal_port_parameter_set /home/pi/mjpg-streamer/mjpg-streamer-experimental/plugins/input_raspicam/input_raspicam.c: In function ‘worker_thread’: /home/pi/mjpg-streamer/mjpg-streamer-experimental/plugins/input_raspicam/input_raspicam.c:885:10: warning: implicit declaration of function ‘mmal_port_pool_create’; did you mean ‘mmal_pool_create’? [-Wimplicit-function-declaration] pool = mmal_port_pool_create(encoder_output, encoder_output->buffer_num, encoder_output->buffer_size); ^~~~~mmal_pool_create /home/pi/mjpg-streamer/mjpg-streamer-experimental/plugins/input_raspicam/input_raspicam.c:885:8: warning: assignment to ‘MMAL_POOL_T ’ {aka ‘struct MMAL_POOL_T ’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion] pool = mmal_port_pool_create(encoder_output, encoder_output->buffer_num, encoder_output->buffer_size); ^ /home/pi/mjpg-streamer/mjpg-streamer-experimental/plugins/input_raspicam/input_raspicam.c:1057:5: warning: implicit declaration of function ‘mmal_port_pool_destroy’; did you mean ‘mmal_pool_destroy’? [-Wimplicit-function-declaration] mmal_port_pool_destroy(encoder->output[0], pool); ^~~~~~ mmal_pool_destroy [ 37%] Linking C shared library input_raspicam.so make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 37%] Built target input_raspicam make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' Scanning dependencies of target input_ptp2 make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 41%] Building C object plugins/input_ptp2/CMakeFiles/input_ptp2.dir/input_ptp2.c.o [ 44%] Linking C shared library input_ptp2.so make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 44%] Built target input_ptp2 make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' Scanning dependencies of target input_uvc make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 48%] Building C object plugins/input_uvc/CMakeFiles/input_uvc.dir/dynctrl.c.o [ 51%] Building C object plugins/input_uvc/CMakeFiles/input_uvc.dir/input_uvc.c.o [ 55%] Building C object plugins/input_uvc/CMakeFiles/input_uvc.dir/jpeg_utils.c.o [ 58%] Building C object plugins/input_uvc/CMakeFiles/input_uvc.dir/v4l2uvc.c.o [ 62%] Linking C shared library input_uvc.so make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 62%] Built target input_uvc make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' Scanning dependencies of target output_file make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 65%] Building C object plugins/output_file/CMakeFiles/output_file.dir/output_file.c.o [ 68%] Linking C shared library output_file.so make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 68%] Built target output_file make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' Scanning dependencies of target output_http make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 72%] Building C object plugins/output_http/CMakeFiles/output_http.dir/httpd.c.o [ 75%] Building C object plugins/output_http/CMakeFiles/output_http.dir/output_http.c.o [ 79%] Linking C shared library output_http.so make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 79%] Built target output_http make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' Scanning dependencies of target output_rtsp make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 82%] Building C object plugins/output_rtsp/CMakeFiles/output_rtsp.dir/output_rtsp.c.o [ 86%] Linking C shared library output_rtsp.so make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 86%] Built target output_rtsp make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' Scanning dependencies of target output_udp make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 89%] Building C object plugins/output_udp/CMakeFiles/output_udp.dir/output_udp.c.o [ 93%] Linking C shared library output_udp.so make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 93%] Built target output_udp make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' Scanning dependencies of target output_viewer make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 96%] Building C object plugins/output_viewer/CMakeFiles/output_viewer.dir/output_viewer.c.o [100%] Linking C shared library output_viewer.so make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [100%] Built target output_viewer make[2]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' make[1]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' pi@raspberrypi:~/mjpg-streamer/mjpg-streamer-experimental $ sudo make install make -C _build install make[1]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' make[2]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 10%] Built target mjpg_streamer make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 17%] Built target input_file make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 31%] Built target input_http make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 37%] Built target input_raspicam make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 44%] Built target input_ptp2 make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 62%] Built target input_uvc make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 68%] Built target output_file make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 79%] Built target output_http make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 86%] Built target output_rtsp make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [ 93%] Built target output_udp make[3]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' make[3]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' [100%] Built target output_viewer make[2]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build' Install the project... -- Install configuration: "Release" -- Installing: /usr/local/bin/mjpg_streamer -- Set runtime path of "/usr/local/bin/mjpg_streamer" to "/usr/local/lib/mjpg-streamer" -- Installing: /usr/local/share/mjpg-streamer/www -- Installing: /usr/local/share/mjpg-streamer/www/control.htm -- Installing: /usr/local/share/mjpg-streamer/www/JQuerySpinBtn.css -- Installing: /usr/local/share/mjpg-streamer/www/jquery.ui.custom.css -- Installing: /usr/local/share/mjpg-streamer/www/stream.html -- Installing: /usr/local/share/mjpg-streamer/www/jquery.ui.widget.min.js -- Installing: /usr/local/share/mjpg-streamer/www/stream_simple.html -- Installing: /usr/local/share/mjpg-streamer/www/index.html -- Installing: /usr/local/share/mjpg-streamer/www/rotateicons.png -- Installing: /usr/local/share/mjpg-streamer/www/JQuerySpinBtn.js -- Installing: /usr/local/share/mjpg-streamer/www/fix.css -- Installing: /usr/local/share/mjpg-streamer/www/javascript_motiondetection.html -- Installing: /usr/local/share/mjpg-streamer/www/javascript.html -- Installing: /usr/local/share/mjpg-streamer/www/java_simple.html -- Installing: /usr/local/share/mjpg-streamer/www/java.html -- Installing: /usr/local/share/mjpg-streamer/www/videolan.html -- Installing: /usr/local/share/mjpg-streamer/www/sidebarbg.gif -- Installing: /usr/local/share/mjpg-streamer/www/example.jpg -- Installing: /usr/local/share/mjpg-streamer/www/LICENSE.txt -- Installing: /usr/local/share/mjpg-streamer/www/jquery.ui.tabs.min.js -- Installing: /usr/local/share/mjpg-streamer/www/static_simple.html -- Installing: /usr/local/share/mjpg-streamer/www/jquery.js -- Installing: /usr/local/share/mjpg-streamer/www/javascript_simple.html -- Installing: /usr/local/share/mjpg-streamer/www/style.css -- Installing: /usr/local/share/mjpg-streamer/www/spinbtn_updn.gif -- Installing: /usr/local/share/mjpg-streamer/www/static.html -- Installing: /usr/local/share/mjpg-streamer/www/cambozola.jar -- Installing: /usr/local/share/mjpg-streamer/www/favicon.png -- Installing: /usr/local/share/mjpg-streamer/www/jquery.rotate.js -- Installing: /usr/local/share/mjpg-streamer/www/jquery.ui.core.min.js -- Installing: /usr/local/share/mjpg-streamer/www/functions.js -- Installing: /usr/local/share/mjpg-streamer/www/java_control.html -- Installing: /usr/local/share/mjpg-streamer/www/bodybg.gif -- Installing: /usr/local/share/mjpg-streamer/www/favicon.ico -- Installing: /usr/local/lib/mjpg-streamer/input_file.so -- Installing: /usr/local/lib/mjpg-streamer/input_http.so -- Installing: /usr/local/lib/mjpg-streamer/input_raspicam.so -- Set runtime path of "/usr/local/lib/mjpg-streamer/input_raspicam.so" to "" -- Installing: /usr/local/lib/mjpg-streamer/input_ptp2.so -- Installing: /usr/local/lib/mjpg-streamer/input_uvc.so -- Installing: /usr/local/lib/mjpg-streamer/output_file.so -- Installing: /usr/local/lib/mjpg-streamer/output_http.so -- Installing: /usr/local/lib/mjpg-streamer/output_rtsp.so -- Installing: /usr/local/lib/mjpg-streamer/output_udp.so -- Installing: /usr/local/lib/mjpg-streamer/output_viewer.so make[1]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer-experimental/_build'