Stream processed frame from openCV to IP - opencv

I have developed a program in Visual Studio 10 using OpenCV and C++.
It is processing frames in real-time from a camera.
As output, I get processed IplImages which I show on display as video using cvShowImage.
Now I want to stream these frames/video to an IP address so that user can see it using a browser(mjpeg) or in VLC (H.264). I did some research and got to know about GStreamer. But it is not available for VS10 and all the links are dead.
Is there any other way to do it without rebuilding my OpenCV library?

GStreamer is available for Visual Studio 2019, and works for opencv 4.2.
This is easy, but a lot of space for mistakes. The Gstreamer pipe works. The extended description is available here Tutorial.
I used3)
- OpenCV source opencv-4.2.0
- OpenCV source opencv_contrib-4.2.0
- Cmake 3.17 release candidate 3, This is important.
I used development and runtime installer for MSVC GStreamer
Gstreamer 1.16.2 runtime installer
Gstreamer 1.16.2 development installer
The following steps are common for OpenCV to build from source and OpenCV installation. Additionally, these resources needs to be added during cmake configuration.
Now build OpenCV project generated by CMAKE in Visual Studio 2019. The last important thing is to set environmental variables to find GStreamer Runtime. Into system variable path: add
xxx\1.0\x86_64\bin
xxx\1.0\x86_64\lib
xxx\1.0\x86_64\lib\gstreamer-1.0
You need to use VideoWriter with gstreamer Pipeline.
VideoWriter writer( "appsrc ! videoconvert ! videoscale ! video/x-raw,width=320,height=240 ! theoraenc ! oggmux ! tcpserversink host=192.168.0.116 port=8080 recover-policy=keyframe sync-method=latest-keyframe unit-format=buffers units-max=1 buffers-max=0 sync=true ",
0,
5,
Size(320, 240),
true);

Related

How to build openCV 3.3.0 with GStreamer on Windows

Having Gstreamer 1.22 successfully installed I'm not able to configure the project to build OpenCV. CMake isn't able to find GStreamer on my machine. Any ideas how two address this issue?
Just found the solution:
Cmake is using FindGstreamerWindows.cmake to find GStreamer on Windows, which is using internal an environment variable called "GSTREAMER_DIR" pointing to ..\gstreamer\1.0\x86_64.
Please make sure GSTREAMER_DIR exists on your machine.
I recently compile Opencv 4.2 with GStreamer on Windows. I use settings for GStreamer as on the following pictures. Make sure you point to correct .lib and include directories. all_Library is gstapp-1.0.lib etc, when configuraing CMAKE to compile OpenCV.
I use Opencv 4.2, CMake 3.17.0 release candidate and Gstreamer 1.16.2 MSVC 64-bit (VS 2019) developer and runtime installer. The whole process is described here install OpenCV on windows GStreamer tutorial
The important part is to set up environmental variables to find Gstreamer Runtime. Into system variable path: add
xxx\1.0\x86_64\bin
xxx\1.0\x86_64\lib
xxx\1.0\x86_64\lib\gstreamer-1.0
Gstreamer pipe from c++ opencv program to the web.

OpenCV 2.4.3 release cannot be found to download

I am trying to install the Projector-Camera Calibration software available on: http://mesh.brown.edu/calibration/ . The software demands having installed Qt 4.8.4 and OpenCV 2.4.3 on my computer. It cannot work (as far as i know according to my research and INSTALL.txt file in the installation package) with any other versions of Qt and OpenCV. My problem is that OpenCV 2.4.3 version is no longer available anywhere on the Internet to download. It is not even available on the official OpenCV website: http://opencv.org/releases.html . I've tried downloading other versions of OpenCV, but none of them seems to work with this calibration software. More specifically, when I try to execute nmake release command in my Developer Command Prompt for VS 2017, the
LINK : fatal error LNK1181: cannot open input file
'opencv_core243.lib'
message is displayed which is expected because other versions of OpenCV do not have opencv_core243.lib file. I've done everything demanded in INSTALL.txt file, the PATH variable is set properly and everything else.
Can anybody help me with this problem or send me a link for downloading the OpenCV 2.4.3 if it is available somewhere on the Internet?
I don't see why the library should be dependent on that version of OpenCV. From my experience, the camera calibration functions are very stable through different versions.
You should be able to build the library with other versions of OpenCV by editing the file projector-calib.pro from:
# Windows 7
win32:OPENCV_DIR = "C:/opencv/opencv-2.4.3/opencv/build"
win32:OPENCV_LIB_DIR = $$OPENCV_DIR/x86/vc10/lib
win32:CV_VER = 243
to:
# Windows 7
win32:OPENCV_DIR = "C:/{YOUR_PATH}/opencv/build"
win32:OPENCV_LIB_DIR = $$OPENCV_DIR/{x64/x86}/vc12/lib
win32:CV_VER = {VERSION}
and substituting {YOUR_PATH}, {X64/X86} and {VERSION} properly. For OpenCV 2.4.13, for example, {VERSION} is 2413.

How to cross compile OpenCV with ffmpeg

I want to cross compile opencv with ffmpeg for arm.
I have cross compiled ffmpeg, how do I configure cmake to see the ffmpeg?
Edit: I am cross compiling for AR Drone 2.0. I use toolchain under platform/linux.
The answer to your specific problem is to use cmake-gui which provides you a visual interface to ease the process of setting up variables, like your ffmpeg package location.
However I have 2 recommendations:
Download the most updated toolchain.
DO NOT USE THIS GUIDE. Use instead the toolchain that you find in the package in sources\platforms\android\android.toolchain.cmake: read inside, you'll find the correct instructions at the beginning of the file.
Another optional recommendation: use ninja as build system, much faster.
I was successful in cross compiling OpenCV with ffmpeg for AR Drone's ARM processor by writing my own toolchain file where I explicitly set all the linker, pkg_config and compiler paths to relevant directories containing the cross-compiled stuff.
I have written a blog post detailing the entire process here:
How to Cross-Compile OpenCV with FFmpeg for AR Drone (ARM Processor).

opencv error: no GPU support

I have install Cuda 6.5 and opencv 2.4.9 with visual studio 2010, when I run gpu, I get error
Opencv Error: No GPU support(the library is compiled without PGU support) in the row_nogpu, file C:/builds/2_4_Packslave-win32-vc10-shared/opencv/modules/gpu/src/precomp.hpp line 135
I get this error, is any one can help what do I have to do?
Thanks
I believe, you have to actually build the libraries with CUDA support. I Imagine This Guide will be useful.
This can be caused because of following.
Use the flag WITH_CUDA=ON during cmake
You are trying to load the libraries which are compiled without GPU support, after you install opencv make sure you change the libraries path to that of GPU supported once.

Getting webcam to work in OpenCV 2.3 with Cygwin

I have a problem trying to get a webcam in OpenCV 2.3 to work with Cygwin. I have a Windows 7 64-bit system and I use Notepad++ and cygwin compilers to do my C++ programming. I have seen other posts with similar problems:
Getting Webcam to work in OpenCV
Can't access webcam with OpenCV
I first tried installing OpenCV via the Cygwin Ports. This is rather easy to install, but alas I run into the webcam problem (always returns false when trying to find a device). I have also attempted to build OpenCV and install manually using the command line flavor of CMake. I tried adding the HAVE_VIDEOINPUT and HAVE_DSHOW flags, but no dice. All my programs compile nicely and I have all the functionality of OpenCV aside for this webcam thing.
Has anyone successfully built OpenCV 2.3 on Cygwin with webcam working?
It is unlikely that cygwin build of OpenCV will be able to access a webcam. At least it is not possible without hacking OpenCV cmake scripts. Under cygwin OpenCV build always follows the UNIX branch and videoinput/directshow is excluded from build.

Resources