1,简介
深度图测量高度原理
1):拟合平面
2):消除相机坐标系对物体表面倾斜的影响
3):将高度图像的域缩小到给定的高度范围。
4):获取区域灰度值 也就是高度
read_image (DistanceImage, 'E:/项目/3D测高/高度/20244927-044910003.tif')
get_image_size (DistanceImage, Width1, Height1)
dev_close_window ()
dev_open_window (0, 0, Width1/2, Height1/4, 'black', WindowHandle)
dev_display (DistanceImage)
dev_set_color ('green')
gen_circle (Circle, [1500,1500,1500],[300,400,500], [15,15,15])
union1 (Circle, RegionDefiningReferencePlane)
dev_set_color ('red')
get_domain (DistanceImage, Domain)
intersection (RegionDefiningReferencePlane, Domain, RegionDefiningReferencePlane)
moments_gray_plane (RegionDefiningReferencePlane, DistanceImage, MRow, MCol, Alpha, Beta, Mean)
get_image_pointer1 (DistanceImage, Pointer, Type, Width, Height)
area_center (RegionDefiningReferencePlane, Area, Row, Column)
gen_image_surface_first_order (ReferencePlaneDistance, Type, Alpha, Beta, Mean, Row, Column, Width, Height)
sub_image (DistanceImage, ReferencePlaneDistance, DistanceImageWithoutTilt, 1, 0)
CosGamma := 1.0 / sqrt(Alpha * Alpha + Beta * Beta + 1)
scale_image (DistanceImageWithoutTilt, DistanceImageCorrected, CosGamma, 0)
MinHeight := -0.2
MaxHeight := 3.05
*如果结果是负值 反转对应正值 如果是正值则无需反转
*invert_image (DistanceImageCorrected, HeightAboveReferencePlane)
threshold (DistanceImageCorrected, Region, MinHeight, MaxHeight)
reduce_domain (DistanceImageCorrected, Region, HeightAboveReferencePlaneReduced)
dev_display (HeightAboveReferencePlaneReduced)
stop ()
gen_rectangle1 (ROI_0, 1236.73, 536.268, 1267.64, 586.108)
gray_features (ROI_0, HeightAboveReferencePlaneReduced, 'mean', ValueMean)
gray_features (ROI_0, HeightAboveReferencePlaneReduced, 'min', ValueMin)
gray_features (ROI_0, HeightAboveReferencePlaneReduced, 'max', ValueMax)
gray_features (ROI_0, HeightAboveReferencePlaneReduced, 'median', ValueMedian)
gray_features (ROI_0, HeightAboveReferencePlaneReduced, 'deviation', ValueDeviation)
dev_set_color ('blue')
threshold (HeightAboveReferencePlaneReduced, Range1,-1, 0)
dev_display (Range1)
dev_set_color ('green')
threshold (HeightAboveReferencePlaneReduced, Range2, 0, 1)
dev_display (Range2)
dev_set_color ('red')
threshold (HeightAboveReferencePlaneReduced, Range3, 1, 5)
dev_display (Range3)