i have problem with light reflection, here's the picture taken with standart 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
how can i remove the backlight or connected the broken line from detected contour?
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.
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