Afr*_*wan 7 java android opencv
我有光反射的问题,这是用标准相机拍摄的照片

和我做的过程
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
Run Code Online (Sandbox Code Playgroud)
这是结果
如何从检测到的轮廓中移除背光或连接虚线?
这里的问题是反射使像素过饱和。这里有两条可能的路径;
调整状态
调整条件是最简单的途径。通过简单地控制拍摄图像的条件,您可以消除大多数(如果不是全部)困难情况(例如这些)。考虑使用偏光滤镜、更好的(例如漫射)照明、更好的曝光设置等。
调整图像
另一种选择(例如,之后删除高光)要困难得多。这主要是因为过饱和破坏了大量数据。最常用的方法是使用 HDR 图像,由于图像是在不同的曝光下拍摄的,因此往往会保留更多的数据。在某些情况下,问题可能是由于RAW转换造成的;但改善这一点通常是相当乏味的。