0

所以我有一个爱好项目,将 USB 显微镜绑在 3D 打印机上,在不同的 X、Y 和 Z 位置拍摄物体的照片,然后将它们拼接成完整的图像。我从这个堆栈中的代码开始生成一个 2D 矩形光栅图案,然后通过在每次 2D 扫描后重复循环移动 Z 轴来升级它以进行 2.5D 成像(堆叠和拼接),最后用一个第 4 轴启用 3D 成像。

问题是大多数东西都不是矩形,扫描最终会变得非常浪费,停下来在不是物体或明显失焦的区域拍照。我希望能够 1:移动“扫描平面”,例如扫描向上倾斜的平面物体,以及 2:通常能够生成任意扫描图案,或者至少是简单的理想形状。

您将如何获取有关 3 维形状的信息(例如,来自 STL),并在表面(或至少指向上方的部分)周围包裹其他 2D“点阵”光栅图案?

4

1 回答 1

0

我想出了用我原来的矩形/长方体扫描做这个的基础知识。数学很容易旋转,例如 Y 轴:


def RotateArray(ScanLocations, degrees = 30):
    #function to rotate a 3D array around a specified axis (currently Y). Ideally, around arb point in space.  
    #X Location minus offset becomes new hypotenuse after rotating.
    #(sin(degrees) * X) + Z gives new Z .
    #cos(degrees)* X gives new X. Right? Y should be unchanged.

    XLocations,ZLocations = ScanLocations['X'],ScanLocations['Z']
    sinof = sin(np.deg2rad(degrees))
    cosof = cos(np.deg2rad(degrees))
    XOffset = min(XLocations) #not fair to assume it is zeroth position

    ZLocations = [round((x-XOffset)*sinof + z,2) for x, z in zip(XLocations, ZLocations)]
    XLocations = [round(((i - XOffset) * cosof)+XOffset,2) for i in XLocations]

    ScanLocations['X'] = XLocations
    ScanLocations['Z'] = ZLocations
    return (ScanLocations)


使用 ncviewer.com 进行可视化:

原始扫描

绕 Y 轴旋转扫描

我现在需要解决的一个新问题是重新安排我的动作以提高效率。我想有选择地优先考虑一个轴,例如 Z,以便将要堆叠的图像在没有 X/Y 移动的情况下拍摄。

于 2020-07-04T22:53:57.650 回答