弯曲曲面 [英] Flatten curved surface

查看:218
本文介绍了弯曲曲面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为牙科成像计算全景投影.

I am trying to compute a panoramic projection for dental imaging purpose.

我有一个通过分段函数在一个方向上弯曲"的矩形表面.如果从顶部看,它看起来像一个常规的分段函数.

I have a rectangle surface "curved" in one direction by a piecewise function. If we look at it from the top, it looks like a regular piecewise function.

逐段线性函数"仅由一组3D点定义. 所有的点都在同一平面上.所有3D点都位于的平面与曲面正交

The "piecewise linear function" is just defined by a set of 3D points. All the points are in the same plane. The plane where all the 3D points sit is orthogonal to the curved surface

(请参阅左上方窗口中的绿线)

(see the green line in the top-left window)

我正在寻找展平"它的正确方法. (非线性变换)

I am looking for the proper way to "flatten" it. (non linear transform)

平坦的表面应与弯曲的表面具有相同的长度". (这不是经典的正交投影)

The flat surface should have the same "length" as the curved one. (it is not a classic orthogonal projection)

最终,我将使用平面"作为画布来显示感兴趣的信息.

Ultimately, I will use the "flat surface" as a canvas to display the information of interest.

(底部窗口)

最好

推荐答案

我这样看:

我会

  1. 从曲线上获取3个后续点P0,P1,P2
  2. 计算U0,V0,U1,V1

  1. take 3 consequent points P0,P1,P2 from your curve
  2. compute U0,V0,U1,V1

U0 = P1-P0
U1 = P2-P1
V0 = cross(U0,(0,0,1)); V0=half_height/|V0|
V1 = cross(U1,(0,0,1)); V1=half_height/|V1|

所以A,B只是P0 +/- V0,而C,DP1 +/- V1.在叉积中,使用与U0,U1非并行的任何矢量我选择了(0,0,1),但如果它是并行的,则选择了其他任意...

so A,B is just P0 +/- V0 and C,D is P1 +/- V1. In the cross product Use any vector non parallel with U0,U1 I chose (0,0,1) but in case it si parallel chose any other...

使ABCD为矩形

make the ABCD a recangle

例如,计算A'B'C'D'

A'.x = B'.x = index_of(P0) * sizex
C'.x = D'.x = index_of(P0) * sizex + sizex
A'.y = D'.y = sizey
B'.y = C'.y = 0

其中sizex,sizey是矩形段的大小.您也可以使用|U0|,|V0|,但在这种情况下,起始x将是积分曲线的长度.

Where sizex,sizey is the size of rectangle segment. You can also use |U0|,|V0| but in that case the start x will be integrated curve length.

计算ABCDA'B'C'D'

compute transformation between ABCD and A'B'C'D'

因此对于ABCD内部的每个像素P计算A'B'C'D'. The x`内部的(x,y)很容易:

so for each pixel P inside ABCD compute (x,y) inside A'B'C'D'. Thex` is easy:

x = A'.x + dot(P-P0,U0)/|P-P0|

y非常棘手,需要进行一些调整以适应您的需求(因此,结果很平顺).对于初学者,请尝试简单的方法(这会导致段之间出现接缝)

y is tricky and need some tweaking to suite your needs (so the result is smooth to your liking). For starters try simple approach (will lead to seams between segments)

y = (A'.y+B'.y)/2 + dot(P-P),V0)/|P-P0|

现在只需将位置P处的像素复制到目标图像中位置(x,y)

Now just copy the pixel at position P into your target image at position (x,y)

要使其更加平滑,您可以根据dot(P-P0,U0)/(|P-P0|*|U0|)V0,V1之间插入V,以便无缝更改.

To make this more smooth you can make V interpolated between V0,V1 dependent on the dot(P-P0,U0)/(|P-P0|*|U0|) so it will change seamlessly.

t = dot(P-P0,U0)/(|P-P0|*|U0|)
V = V0 + (V1-V0)*t
y = (A'.y+B'.y)/2 + dot(P-P),V)/|P-P0|

如果您需要帮助确定点是否在内部,则像素P在内部是否

If you need help with determining if point is inside then pixel P is inside if

dot(P-P0,U0)/(|P-P0|*U0) = <0.0,1.0>

  • 曲线的所有段的#1循环

    按曲线的单个采样点(而不是按3 ...)

    step by single sample point of curve (not by 3 ...)

    这篇关于弯曲曲面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆