imshow is returning lots of static like an old tv. Has anyone else seen this? [closed]
//this shows my webcam stream with lots of noise. like an old tv set on the wrong channel. Please help.
#include "pch.h"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
using namespace std;
using namespace cv;
int main(int argc, char** argv)
{
VideoCapture cap;
cap.open(0);
if (!cap.isOpened())
{
printf("--(!)Error opening video capture\n");
return -3;
}
Mat image;
namedWindow("Image", WINDOW_AUTOSIZE);
while (1)
{
cap.read(image);
imshow("Image", image);
waitKey(30);
}
return 0;
}
/////
opencv version / os ?
blind guess: it's a problem with the MSMF webcam backend, can you try:
? (use directshow, not msmf)
Basic troubleshooting: Is it just imshow or do you see it with imwrite too?
Meaning, is the problem in imshow or in the image reading?