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
The mean filter is used to blur an image in order to remove noise. It involves determining the mean of the pixel values within a n x n kernel. The pixel intensity of the center element is then replaced by the mean. This eliminates some of the noise in the image and smooths the edges of the image.
Image noise is random variation of brightness or color information in images, and is usually an aspect of electronic noise. It can be produced by the image sensor and circuitry of a scanner or digital camera. Image noise can also originate in film grain and in the unavoidable shot noise of an ideal photon detector.
Gaussian Noise is a statistical noise with a Gaussian (normal) distribution. It means that the noise values are distributed in a normal Gaussian way. An example of a normal (Gaussian) distribution. The Gaussian noise is added to the original image.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With