Reputation: 131
I have a car detecting project in OpenCV2.3.1 and visual C++.
In foreground segmentation, there's reflections due to illumination.
And this (reflections) become part of the foreground after the background
has been removed.
I need suggestions or ideas on how to remove this noise. As it causes some foreground objects to be connected up as one object, like seen when using findContours and drawContours functions. See image parts highlighted in red on attached image. I think this will simplify the blob detection stage.
*note - I am not allowed to use built-in cvBlobLib in OpenCV
Upvotes: 6
Views: 5613
Reputation: 20620
Issue here is that part of a glare can be either background or corresponding car.
Here is what I would do.
I believe you would not have a big problem with identifying glare parts by binarizing and thresholding or in a similar way.
Once identified all pixels of glares, I would replace each of the glare pixels with nearest non-glare pixel in the same row of the image. That way, a glare will be filled with car and background. With this method, then you would be able to detect cars without much problem.
Upvotes: 4
Reputation: 1441
maybe try to convert the image to HSV then filter high V amounts
IplImage imgHSV = cvCreateImage(cvGetSize(imgInput), 8, 3);
IplImage imgThreshold = cvCreateImage(cvGetSize(imgHSV), 8, 1);
cvInRangeS(imgHSV, cvScalar(0, 0, 90, 0), cvScalar(0, 0, 100, 0), imgThreshold);
..adjust scalars as needed to remove glare
Upvotes: 3