简体   繁体   English

使用Opencv检测文本上的角点

[英]Detect corner points on text with Opencv

I need a help on image processing on opencv, I have a kind of trapez to process, so I need to warp Perspective, it´s easy to do this, but I need extract source points on this image. 我需要在opencv上进行图像处理的帮助,我需要处理某种梯形,因此我需要进行透视变形,这很容易做到,但是我需要在该图像上提取源点。 Note, the image has only a text, on this example I draw red lines to show what I need to get. 注意,图像只有一个文本,在此示例中,我绘制了红线以显示需要获取的内容。 I need detect the corner points (marked with a blue point on example). 我需要检测拐角点(示例中标有蓝点)。

在此处输入图片说明

Any help? 有什么帮助吗?

You can isolate the text inside the image by executing the bounding box technique , and the corner points will be stored by the vertices variable: 您可以通过执行边界框技术来隔离图像内部的文本,并且拐角点将由vertices变量存储:

cv::Point2f vertices[4];
box.points(vertices);

and you'll be able to manipulate them by accessing their X,Y coordinates: 您将可以通过访问它们的X,Y坐标来操纵它们:

std::cout << "Point 1: " << vertices[0].x << "," << vertices[0].y << std::endl;
std::cout << "Point 2: " << vertices[1].x << "," << vertices[1].y << std::endl;
std::cout << "Point 3: " << vertices[2].x << "," << vertices[2].y << std::endl;
std::cout << "Point 4: " << vertices[3].x << "," << vertices[3].y << std::endl;

The link I shared provides a complete implementation of this technique. 我共享的链接提供了该技术的完整实现。 It is the droid you are looking for! 这是您要寻找的机器人!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM