Image processing 图像中矩形区域的识别

Image processing 图像中矩形区域的识别,image-processing,opencv,Image Processing,Opencv,这听起来很简单,但我有很多问题 通过Hough变换,我想我可以从图像中得到ROI。但是由于我们的3D世界和我不完美的手协调,ROI是倾斜的,或者有透视投影-也就是说,它不是一个真正的矩形进行进一步的分析 有什么办法可以解决这个问题吗?您可以使用getPerspectiveTransform()和warpPerspectiveTransform()将它再次变成一个矩形 //cornerpoints contains the Point2f corners you detected in the i

这听起来很简单,但我有很多问题

通过Hough变换,我想我可以从图像中得到ROI。但是由于我们的3D世界和我不完美的手协调,ROI是倾斜的,或者有透视投影-也就是说,它不是一个真正的矩形进行进一步的分析


有什么办法可以解决这个问题吗?

您可以使用
getPerspectiveTransform()
warpPerspectiveTransform()
将它再次变成一个矩形

//cornerpoints contains the Point2f corners you detected in the image in clockwise ordering from top left
int rectheight=480;
int rectwidth=640;
Point2f rectpoints[4];
rectpoints[0]=Point2f(0,0);
rectpoints[1]=Point2f(0,rectwidth);
rectpoints[2]=Point2f(rectheight,rectwidth);
rectpoints[3]=Point2f(rectheight,0);
Mat pt=getPerspectiveTransform(cornerpoints,rectpoints);
Mat rectangle(rectheight,rectwidth,CV_8U);
warpPerspective(image,rectangle,pt,Size(rectheight,rectwidth));

您可以使用
getPerspectiveTransform()
WarpPerspectiveTransform()
将其再次变成矩形

//cornerpoints contains the Point2f corners you detected in the image in clockwise ordering from top left
int rectheight=480;
int rectwidth=640;
Point2f rectpoints[4];
rectpoints[0]=Point2f(0,0);
rectpoints[1]=Point2f(0,rectwidth);
rectpoints[2]=Point2f(rectheight,rectwidth);
rectpoints[3]=Point2f(rectheight,0);
Mat pt=getPerspectiveTransform(cornerpoints,rectpoints);
Mat rectangle(rectheight,rectwidth,CV_8U);
warpPerspective(image,rectangle,pt,Size(rectheight,rectwidth));

你有没有想过使用冈萨雷斯在书中提出的形状签名?如果已经对形状进行了分割和标记,则计算起来既简单又快速


你有没有想过使用冈萨雷斯在书中提出的形状签名?如果已经对形状进行了分割和标记,则计算起来既简单又快速


如果你提供一个图像示例,我可以将你重定向到处理此问题的有趣的SO帖子。如果你提供一个图像示例,我可以将你重定向到处理此问题的有趣的SO帖子。这正是我需要的。非常感谢!这正是我需要的。非常感谢!