I have images of a smelting cube, forming into a droplet over time. So far, i extracted the contour of it, but next i'd need to to distinguish between object and surface. My Idea is to detect the corners where object touches surface, but i am struggling to find a reasonable approach how to do so (preferably using the c++ interface of opencv). I'd appreciate any suggestions.
Here are some examples of the extracted contour:
![4](https://i.stack.imgur.com/ckU4q.png)
编辑:
@哈里斯:
我尝试了你的建议的一个变体,它正在为我完成工作:
在近似轮廓中,我从左侧接近,寻找具有指定范围内的值的第一个角度,然后从右侧进行相同的操作。由于近似轮廓点是原始轮廓点的子集,因此我识别原始序列中的 2 个角点,并在两个角处切割它。中间部分我作为水滴,左右部分我重新组合成我的表面线。可能有更好、更稳定的方法,但这对我有用。谢谢!
你可以尝试这个方法,
Find 轮廓和 approxPolyDP。 http://docs.opencv.org/doc/tutorials/imgproc/shapedescriptors/bounding_rects_circles/bounding_rects_circles.html
假设你有近似PolyDP点,如P1、P2、P3等......
现在计算连续线之间的角度,即线(P1,P2),线(P2,P3)等之间的角度。并检查每条调整线的角度差异,如果差异接近90度,你可以说有是一个角。
对于角度,您可以使用方程
double Angle = atan2(y2 - y1, x2 - x1) * 180.0 / CV_PI;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)