Highgui V4L error when using MJPEG for OpenCV - opencv

I am running OpenCV on an ARM A9 processor. I am trying to use MJPEG so my C920 webcam runs a lot faster. The beginning of my program is as follows:
VideoCapture cap(CV_CAP_ANY);
cap.set(CV_CAP_PROP_FOURCC, CV_FOURCC('M', 'J', 'P', 'G'));
cap.set(CV_CAP_PROP_FRAME_WIDTH, 640);
cap.set(CV_CAP_PROP_FRAME_HEIGHT, 480);
The programs compiles, however, the following error appears when I run it:
HIGHGUI ERROR: V4L: Property <unkown property string>(6) not supported by device
I am completely clueless on what to do. Does anyone have an idea of why this error is occurring?

Related

GStreamer: cannot link elements in `CvVideoWriter_GStreamer::open` running OpenCV C++ application

I am trying to run an OpenCV program that opens a USB cam and streams the video.
The program compiles but when I run it I get the following GStreamer exception (which seems unrelated to OpenCV or the C++ source code):
(TLD:5263): GStreamer-CRITICAL **: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
OpenCV Error: Unspecified error (GStreamer: cannot link elements
) in CvVideoWriter_GStreamer::open, file /home/odroid/Desktop/middleware/CppLibs/opencv-2.4.13.6/modules/highgui/src/cap_gstreamer.cpp, line 1464
terminate called after throwing an instance of 'cv::Exception'
what(): /home/odroid/Desktop/middleware/CppLibs/opencv-2.4.13.6/modules/highgui/src/cap_gstreamer.cpp:1464: error: (-2) GStreamer: cannot link elements
in function CvVideoWriter_GStreamer::open
I am running on odroid.
Have anybody had the same problem?
I was thinking it is a package dependency problem but I have installed xorg libgl-gst libgl1-mesa-* so I am quite lost at the moment.
EDIT
To be precise it is an older version of OpenCV: it is the 2.4.13.6.
The lines initializing VideoCapture are the following (I reported only the relevant ones):
int main(int argc,char** argv){
string devId;
VideoCapture capture;
if(argc>4)
{
int captureNumber;
string deviceId=argv[1];
captureNumber=atoi(argv[1]);
capture.open(captureNumber);
}
EDIT 2
On OSX the same code works without giving this exception (there were only dynamic libraries problem).

Gstreamer Opencv backend doesn't support this codec acutally

This is a problem I got when launching my own project,
OpenCV Error: Unsupported format or combination of formats (Gstreamer
Opencv backend doesn't support this codec acutally.) in
CvVideoWriter_GStreamer::open, file
/home/htf/Downloads/opencv-2.4.9/modules/highgui/src/cap_gstreamer.cpp,
line 505
Qt has caught an exception thrown from an event handler. Throwing
exceptions from an event handler is not supported in Qt. You must
reimplement QApplication::notify() and catch all exceptions there.
terminate called after throwing an instance of 'cv::Exception'
what(): /home/htf/Downloads/opencv-2.4.9/modules/highgui/src/cap_gstreamer.cpp:505:
error: (-210) Gstreamer Opencv backend doesn't support this codec
acutally. in function CvVideoWriter_GStreamer::open
Aborted (core dumped)
opencv version: 2.4.9
I am new to OpenCV, does anyone know how to fix this problem? Your clues would be appreciated too.
Looks like you passed an unsupported fourcc argument to the VideoWriter class.
The list of supported values of fourcc for CvVideoWriter_GStreamer in OpenCV 2.4.9 can be found at: https://github.com/opencv/opencv/blob/2.4.9/modules/highgui/src/cap_gstreamer.cpp#L462.
Just out of curiosity, why are you using a self compiled version of OpenCV?

Qt 5.5 Video shader issue on iOS

I'm working with Qt(especially 5.5) on iOS device not simulator
I'm just add Video object to QML code for play HLS stream like below.
Video {
id: livePlayer
anchors.fill: parent
source: "http://content.jwplatform.com/manifests/vM7nH0Kl.m3u8"
autoPlay: true
}
But Qt returns me bug with log like below
Failed to find shader ":/qtmultimediaquicktools/shaders/rgbvideo.vert"
Failed to find shader ":/qtmultimediaquicktools/shaders/rgbvideo.frag"
QOpenGLShader::link: "ERROR: Compiled vertex shader was corrupt.\nERROR: Compiled fragment shader was corrupt.\n"
shader compilation failed:
"ERROR: Compiled vertex shader was corrupt.\nERROR: Compiled fragment shader was corrupt.\n"
QOpenGLShader::link: "ERROR: Compiled vertex shader was corrupt.\nERROR: Compiled fragment shader was corrupt.\n"
QOpenGLShaderProgram::uniformLocation( qt_Matrix ): shader program is not linked
QOpenGLShaderProgram::uniformLocation( rgbTexture ): shader program is not linked
QOpenGLShaderProgram::uniformLocation( opacity ): shader program is not linked
I was doing somethings what I can -Clean, Run QMake, etc-
But its useless.
Give me some help plz.
Thanks have a good day.
This is a temporary bug in the Qt 5.5 branch.
To fix it with the current 5.5 snapshots, add this to your main() function:
Q_INIT_RESOURCE(qtmultimediaquicktools);
The issue is already fixed in the current 5.5 branch of Qt, find the fix here or wait for the next snapshot.

Error Handling in opencv gpu

How to handle opencv gpu exceptions? Is there any specific set of error code api for opencvgpu exception handling?
I tried searching a lot but I only got 1 error code i.e. CV_GpuNotSupported.
Please help me out.
While I'm assuming that you know that CV_GpuNotSupported is NOT how OpenCV handles GPU exceptions, and in fact, it handles error when you try to call gpu methods without compiling OpenCV with -DHAVE_CUDA or -DHAVE_OPENCL, the way OpenCV (I also assume the newest OpenCV released version, 2.4.5) handles error codes, is defined in these files:
For methods that use NVIDIA CUDA:
https://github.com/Itseez/opencv/blob/2.4.5/modules/gpu/src/error.cpp
https://github.com/Itseez/opencv/blob/2.4.5/modules/gpu/src/precomp.hpp
For methods that use OpenCL:
https://github.com/Itseez/opencv/blob/2.4.5/modules/ocl/src/error.cpp
https://github.com/Itseez/opencv/blob/2.4.5/modules/ocl/src/precomp.hpp
As for the API, you can use cv::gpu::error or cv::ocl::error. Or to get the error string, getErrorString for cv::gpu and getOpenCLErrorString. And by the way for CUDA's error you have to specify whether it's an NPP, NCV, cufft, or cublas error.

Stack around variable corrupted when using cvBlobsLib (OpenCV)

I am trying to do simple image processing with OpenCV and the cvBlobsLib in Visual C++ 2008, and I get an error message when I try to create a CBlobResult object
IplImage* original = cvLoadImage("pic6.png",0);
cvThreshold(original, original, 100, 255, CV_THRESH_BINARY);
CBlobResult blobs = CBlobResult(original, NULL, 255);
The message is the following:
Run-Time Check Failure #2 - Stack around the variable blobs was corrupted
Why does this happen? How should I create this object? Thank you very much for your help.
Sorry. Actually it was my fault. I was trying to compile the debug version of my project with the release version of the cvBlobsLib library. As soon as I linked the debug version it worked.

Resources