绘制一个矩形边界离线人手写签名

时间:2015-03-25 07:40:39

标签: c++ opencv

我正在开发一个检测离线人手写签名的项目。我使用opencv版本2.4.10和C ++作为编程语言。我陷入了一种情况,在这种情况下,我想绘制一个限制签名的矩形框。我的输出应该是四个坐标,如果使用,CvRectangle函数,我可以绘制它。我使用了有界盒子方法,但它给了我错误的输出。它为同一图像创建多个有界框。这是因为签名不连续,其轮廓变化很大。我需要一个与签名相邻的直角矩形。

1 个答案:

答案 0 :(得分:1)

首先为每个轮廓找到boundingRect并执行并集操作。 矩形上的完整list of operations

// In addition to the class members, the following operations 
// on rectangles are implemented:

// (shifting a rectangle by a certain offset)
// (expanding or shrinking a rectangle by a certain amount)
rect += point, rect -= point, rect += size, rect -= size (augmenting operations)
rect = rect1 & rect2 (rectangle intersection)
rect = rect1 | rect2 (minimum area rectangle containing rect2 and rect3 )
rect &= rect1, rect |= rect1 (and the corresponding augmenting operations)
rect == rect1, rect != rect1 (rectangle comparison)


  [1]: http://docs.opencv.org/modules/core/doc/basic_structures.html?highlight=rect#Rect_