2015-03-25 61 views
0

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

+0

将这些框联合在一起。 – Wain 2015-03-25 07:51:17

回答

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_