Straightening a curved contour

2019-08-25 06:39发布

Given a contour with an easily-identifiable edge, how would one straighten it and its contents, as pictured?

enter image description here

1条回答
爷、活的狠高调
2楼-- · 2019-08-25 07:35

Detect the black edge and fit a spline curve to it.

From that spline you will be able to draw normals, and mark points regularly along it. This forms a (u, v) mesh that is easy to straighten.

To compute the destination image, draw horizontal rows, which correspond to particular normals in the source. Then sampling along the horizontal corresponds to some fractional (x, y) coordinates in the source. You can perform bilinear interpolation around the neighboring pixels to achieve good quality resampling.

查看更多
登录 后发表回答