I have built a SunFounder PiCar-V (Raspberry Pi 3 running Raspbian) which uses a Python server "running a software written for the MJPG-streamer project". I wish to capture the video stream with OpenCV 3.30 x64 in C++. Below is my test program which shows the result occurring.
// ============================================================================ // PiCarVideoTest - Testing how to use OpenCV to open PiCar video stream. // Debug x64 version with property sheet: // C++ - Additional Include Directories: $(OPENCV_BUILD)\include // Linker - Additional Library Directories: $(OPENCV_BUILD)\x64\vc14\lib // Linker - Additional Dependencies: opencv_world330d.lib;... // Result of program - vcap.open fails: // warning: Error opening file(/build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:792) // warning: http://192.168.0.81:8080/?action=stream;dummy=param.mjpg (/build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:793) // ============================================================================
include <opencv2\opencv.hpp>
include <opencv2\highgui.hpp>
using namespace cv;
int main(int, char**) { VideoCapture vcap; Mat image;
// Setup video stream location per internet research results.
const std::string videoStreamAddress = "http://192.168.0.81:8080/?action=stream;dummy=param.mjpg";
// Open the video stream and check that open was successful.
if (!vcap.open(videoStreamAddress)) {
std::cout << "Error opening video stream or file" << std::endl;
return -1;
}
...
It appears OpenCV is attempting to treat the internet address as a file name. I have fought this problem for two days and have not been successful at solving it. Any help would be greatly appreciated!!