【发布时间】:2014-01-28 13:10:08
【问题描述】:
我正在尝试将 bgr 垫转换为 hsv 垫以进行某些检测,但 hsv 图像不断出现块状。这是我在 C++ 中的代码:
int main() {
const int device = 1;
VideoCapture capture(device);
Mat input;
int key;
if(!capture.isOpened()) {
printf("No video recording device under device number %i found. Aborting program...\n", device);
return -1;
}
namedWindow("Isolation Test", CV_WINDOW_AUTOSIZE);
while(1) {
capture >> input;
cvtColor(input, input, CV_BGR2HSV);
imshow("Isolation Test", input);
key = static_cast<int>(waitKey(10));
if(key == 27)
break;
}
destroyWindow("Isolation Test");
return 0;
}
Here 是输出的快照。当我注释掉 cvtColor 时,输入看起来并不块状。有什么问题,我应该怎么做才能解决它?
【问题讨论】:
-
在转换之前图像可能是块状的,但很难检测到。 JPEG/MPEG 压缩利用了我们的“视觉管道”的缺陷,并由此产生了许多难以检测的伪影,当您使用假色(例如 HSV 通道)显示图像时,它们有时会变得非常明显。您可以将图像保存为无损格式 (png/tiff),并使用颜色检查器检查实际值。
-
我什至可以在 3.0 (master) 中重现它。还具有不同的网络摄像头型号/驱动程序。它只发生在网络摄像头捕获中,而不是 imread()。不错的谜题;)
-
@scribblemaniac,你可能想make an issue here