我正在使用 OpenCV。我想将具有平行四边形的图像转换为矩形图像。请告诉我该怎么做?
谢谢。
查看有关仿射变换的 OpenCV 文档。那里有例子:
http://opencv.willowgarage.com/documentation/cpp/geometric_image_transformations.html
您想要剪切图像(或其中的一部分)
为此,您可以使用带有warpAffine 函数的仿射变换
void warpAffine(const Mat& src, Mat& dst, const Mat& M, Size dsize,
int flags=INTER_LINEAR, int borderMode=BORDER_CONSTANT,
const Scalar& borderValue=Scalar())
并阅读此问答:在 OpenCV 中执行更改原点的剪切