我尝试运行以下代码:
#include<opencv\cv.h>
#include<opencv\highgui.h>
using namespace cv;
int main() {
VideoCapture cap;
cap.open(0);
while (1) {
Mat src;
Mat threshold;
cap.read(src);
inRange(src, Scalar(0, 0, 0), Scalar(255, 0, 0), threshold);
imshow("thr", threshold);
imshow("hsv", src);
waitKey(33);
}
return 0;
}
但是似乎它没有过滤,因为当我运行代码时只有一个空白窗口出现。
如何让这段代码检测红色?