Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenCV light reflection reduction

i have problem with light reflection, here's the picture taken with standart camera

Original Image taken with camera

and process that i do

1. blur the image
    Imgproc.GaussianBlur(blurred, blurred, new Size(17, 17),
    Imgproc.BORDER_ISOLATED);
2. create second empty image that using hsv
    Imgproc.cvtColor(gray0, gray0, Imgproc.COLOR_BGR2HSV);
3. mix the image color chanel (fromto {0,0})
    Core.mixChannels(blurredlist, graylist, fromto);
4. Threshold, Canny, and delate
Imgproc.threshold(gray0, gray0, 126, 255, Imgproc.THRESH_TRUNC);
Imgproc.Canny(gray0, gray0, 50, 70);
Imgproc.dilate(gray0, gray0, Mat.ones(new Size(3, 3), 0));
5. finding the contour
    Imgproc.findContours(gray0, contours, new Mat(), Imgproc.RETR_EXTERNAL,
        Imgproc.CHAIN_APPROX_SIMPLE);
6. magicall filter for biggest contour and stuff

and here is the result After Thresholding how can i remove the backlight or connected the broken line from detected contour?

like image 205
Afriyandi Setiawan Avatar asked Jun 23 '14 06:06

Afriyandi Setiawan


1 Answers

The problem here is that the reflection oversaturates the pixels. There are two possible paths to take here;

Adjust the condition

Adjusting the condition is the easiest path. By simply controling the conditions by which the image is taken, you can remove most (if not all) difficult situations (such as these). Think about using polarized filters, better (eg; diffuse) lighting, better exposure settings, etc.

Adjust the image

The other option (eg; removing the highlights afterwards) is much more difficult. This is mostly because the oversaturation destroys a lot of data. The most common used method for this is to use HDR images, which tend to preserve a lot more data, as the images are taken at varying exposures. In some cases the problem might occur due to the RAW conversion; but improving that is generally quite tedious.

like image 149
Nallath Avatar answered Oct 04 '22 16:10

Nallath