How do you stop a capture frame getting split ?
I have a simple program.
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "iostream"
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
Mat frame;
VideoCapture capture;
capture.open(0);
if(!capture.isOpened()){ // check if we succeeded
cout << "Cannot open capture." << endl;
return -1;
}
capture.read(frame);
imwrite("img.jpg", frame);
capture.release();
return 0;
}
It usually works with a good photo
but sometimes it doesn't
How does one stop this frame splitting ?
honestly, i've never seen something like that happen before
hardware ? os ? opencv version ?
with your code i get a black image because my webcam need some time to warm up. see my answer here
O/S is Linux 4.1.7 on a Raspberry Pi B+
OpenCV 2.4.10
USB video class driver is 1.1.1
Camera identified in system logs as...
Jan 1 00:00:04 rfm69cw kern.info kernel: [ 4.698340] usb 1-1.5: New USB device found, idVendor=1908, idProduct=2311
Jan 1 00:00:04 rfm69cw kern.info kernel: [ 4.733121] uvcvideo: Found UVC 1.00 device USB2.0 PC CAMERA (1908:2311)
Jan 1 00:00:04 rfm69cw kern.info kernel: [ 4.737792] input: USB2.0 PC CAMERA as /devices/platform/bcm2708_usb/usb1/1-1/1-1.5/1-1.5:1.0/input/input0
It's strange : there is no visible step between two blocks (x~290).
May be compression killed this step...
I've seen this type of image corruption when a USB2 camera is connected to a USB3 port or a USB SS port.