本文介绍了对象轮廓上的opencv角点检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个熔炼立方体的图像,随着时间的推移形成一个液滴。到目前为止,我提取了它的轮廓,但下一步,我需要区分对象和表面。我的想法是检测物体接触表面的角落,但我正在努力找到一个合理的方法如何这样做(最好使用opencv的c ++接口)。我将感谢任何建议。

以下是一些提取轮廓的示例:

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:

编辑:
@Haris:

edit:@Haris:

我已经尝试过您的建议的一个变体,它正在为我做这项工作:

i have tried a variant of your suggestion and it is doing the job for me:

在近似轮廓中, ,查找具有指定范围中的值的第一个角度,然后从右侧开始。由于近似轮廓点是原始轮廓点的子集,因此我识别原始序列中的2个角点,并在两个角处剪切它。中间部分我作为液滴,左和右部分,我重新标记为我的表面线。可能有更好,更稳定的方法,但这对我有用。感谢!

In the approximated contour i approach from the left, looking for the first angle with a value in a specified range, then the same from the right. As the approximated contour points are a subset of the original contour points, I then identify the 2 corner points in the original sequence, and cut it at both corners. The middle part i take as the droplet, and the left and right part, i reassamble to be my surface line. There might be better, more stable approaches, but this works for me. Thanks!

推荐答案

您可以尝试此方法,


  1. 查找

假设你有P1,P2,P3等aboutPolyDP点...

Suppose you got approxPolyDP point like P1,P2,P3 etc...

现在计算连续线之间的角度,即线(P1,P2),线(P2,P3)等之间的角度,并检查每条调整线的角度差,如果差接近90度可以说有一个角落。

Now calculate angle between consecutive line, that is angle between line(P1,P2), line(P2,P3) etc.. and check the difference in angle for each adjustment line, if the difference comes close to 90 degree you can say there is a corner.

对于Angle,您可以使用方程式

For Angle you can use the equation

double Angle = atan2(y2 - y1, x2 - x1) * 180.0 / CV_PI;

这篇关于对象轮廓上的opencv角点检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-16 08:05