已知多条折线和一个点,求包围该点的最小多边形

C++语言 码拜 9年前 (2015-05-11) 1183次浏览 0个评论

已知多条折线和一个点,求包围该点的最小多边形
图中黑色的为已知折线,绿色为已知点,红色的为需要求出来的多边形顶点。

所求多边形可能为有孔多边形也可能不是

40分
计算几何大牛:http://www.codeproject.com/KB/recipes/Wykobi.aspx
引用 1 楼 zhao4zhong1 的回复:

计算几何大牛:http://www.codeproject.com/KB/recipes/Wykobi.aspx

找了一遍,没发现相同的问题,都是给定多边形区域的,找点是否属于这个区域的,我的问题是事先不知道多边形区域,已知点后构建这个多边形区域。

为什么就是找不到资料呢 
FloodFill
The FloodFill function fills an area of the display surface with the current brush. The area is assumed to be bounded as specified by the crFill parameter. 

Note  The FloodFill function is included only for compatibility with 16-bit versions of Windows. For Win32-based applications, use the ExtFloodFill function with FLOODFILLBORDER specified. 

BOOL FloodFill(
  HDC hdc,          // handle to device context
  int nXStart,      // x-coordinate, where fill begins
  int nYStart,      // y-coordinate, where fill begins
  COLORREF crFill   // fill color
);
 
Parameters
hdc 
Handle to a device context. 
nXStart 
Specifies the logical x-coordinate of the point where filling is to begin. 
nYStart 
Specifies the logical y-coordinate of the point where filling is to begin. 
crFill 
Specifies the color of the boundary or of the area to be filled. 
Return Values
If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. 

Windows NT: To get extended error information, callGetLastError. 

Remarks
Following are reasons this function might fail: 

The fill could not be completed. 
The given point has the boundary color specified by the crFill parameter. 
The given point lies outside the current clipping region — that is, it is not visible on the device. 
See Also
Bitmaps Overview, Bitmap Functions, ExtFloodFill 

 
+

OpenCV的膨胀或腐蚀+轮廓提取

帮顶
虽然我不懂。。。
引用 4 楼 zhao4zhong1 的回复:

FloodFill
The FloodFill function fills an area of the display surface with the current brush. The area is assumed to be bounded as specified by the crFill parameter. 

Note  The FloodFill function is included only for compatibility with 16-bit versions of Windows. For Win32-based applications, use the ExtFloodFill function with FLOODFILLBORDER specified. 

BOOL FloodFill(
  HDC hdc,          // handle to device context
  int nXStart,      // x-coordinate, where fill begins
  int nYStart,      // y-coordinate, where fill begins
  COLORREF crFill   // fill color
);
 
Parameters
hdc 
Handle to a device context. 
nXStart 
Specifies the logical x-coordinate of the point where filling is to begin. 
nYStart 
Specifies the logical y-coordinate of the point where filling is to begin. 
crFill 
Specifies the color of the boundary or of the area to be filled. 
Return Values
If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. 

Windows NT: To get extended error information, callGetLastError. 

Remarks
Following are reasons this function might fail: 

The fill could not be completed. 
The given point has the boundary color specified by the crFill parameter. 
The given point lies outside the current clipping region — that is, it is not visible on the device. 
See Also
Bitmaps Overview, Bitmap Functions, ExtFloodFill 

 
+

OpenCV的膨胀或腐蚀+轮廓提取

赵4老师老师可能我没有说清楚问题,我需要具体输出多边形的顶点坐标值,而轮廓提取之后只是图像数据,怎样才能精确的由图像数据转成顶点值呢?

OpenCV的轮廓提取的结果就是顶点坐标。

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明已知多条折线和一个点,求包围该点的最小多边形
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!