因此,我有一个爱好项目,将USB显微镜捆绑在3D打印机上,在不同的X、Y和Z位置拍摄物体的照片,然后将其缝合成完整的图像。我从这个stack的代码开始生成2D矩形光栅图案,然后升级到2.5D成像(堆叠和拼接),在每次2D扫描后重复循环以移动Z轴,最后对第四个轴执行相同的操作以启用3D成像。
问题是,大多数东西都不是矩形的,扫描可能会变得非常浪费,停下来在不是物体或明显模糊的区域拍摄照片。我希望能够1:移动“扫描平面”,例如扫描一个向上倾斜的扁平物体,以及2:一般情况下能够生成任意的扫描图案,或者至少是简单的理想形状。
如何获取有关三维形状的信息(例如,来自STL),并将其他2D“点阵”光栅图案包裹在表面周围(或至少指向上方的部分)?
发布于 2020-07-05 06:53:58
我用我最初的矩形/长方体扫描找出了做这件事的基础。数学很容易旋转,例如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进行可视化:
我现在需要解决的一个新问题是重新安排我的动作以提高效率。我想有选择地优先选择一个轴,例如Z轴,这样将被堆叠的图像在拍摄时没有X/Y移动。
https://stackoverflow.com/questions/62724523
复制相似问题