拉直弯曲的轮廓 [英] Straightening a curved contour
问题描述
给出具有容易识别的边缘的轮廓,如图所示,如何将其及其内容拉直?
Given a contour with an easily-identifiable edge, how would one straighten it and its contents, as pictured?
推荐答案
检测黑色边缘并为其拟合样条曲线.
Detect the black edge and fit a spline curve to it.
从该样条曲线中,您将能够绘制法线,并沿其定期标记点.这样会形成易于拉直的(u,v)网格.
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.
要计算目标图像,请绘制水平行,这些行与源中的特定法线相对应.然后,沿水平方向的采样对应于源中的某些分数(x,y)坐标.您可以在相邻像素周围执行双线性插值,以实现高质量的重采样.
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.
这篇关于拉直弯曲的轮廓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!