日安
我正在尝试通过在指定范围内减去一些颜色来过滤视频。但是,当记录的图像是静止的或没有变化的时候,HSV滤波后的图像看起来抖动和不稳定。这种抖动或不稳定会在我的处理过程中造成很多问题。有什么方法可以稳定地过滤图像吗?
这是我的过滤器的示例代码...代码的一部分
while (1)
{
//first frame read
cap.read(origonal1);
morphOps(origonal1);
cvtColor(origonal1, HSV1, COLOR_BGR2HSV);
inRange(HSV1, Scalar(0, 129,173), Scalar(26,212, 255), thresholdImage1);
waitKey(36);
//second image read and convert it to HSV
cap.read(origonal2);
morphOps(origonal2);
cvtColor(origonal2, HSV2, COLOR_BGR2HSV);
inRange(HSV2, Scalar(28, 89, 87), Scalar(93, 255, 255),thresholdImage2);
morphOps(thresholdImage1);
morphOps(thresholdImage2);
//create a mask so that i only detect motion of certain color range and don't
//care about other colors motion detection
maskImage = thresholdImage1 | thresholdImage2;
//make the difference between images
absdiff(thresholdImage1,thresholdImage2,imageDifference);
imageDifference = imageDifference&maskImage;
morphOps(imageDifference);
imshow("threshold Image", imageDifference);
//search for movement now update the origonal image
searchForMovement(thresholdImage1, origonal1);
imshow("origonal", origonal1);
imshow("HSV", HSV1);
imshow("threshold1", thresholdImage1);
imshow("threshold2", thresholdImage2);
//wait for a while give a break to the processor
//waitKey(1000);
}




提前谢谢。
发布于 2015-09-17 18:23:53
尝试此函数
fastNlMeansDenoisingColored( frame, frame_result, 3, 3, 7, 21 );它太慢了,但很适合尝试。
https://stackoverflow.com/questions/31398066
复制相似问题