read_image (Image, './Image.jpg')
dev_get_window (WindowHandle)
*//点的rake范围
*//这里设置rake的起点和终点
Row1:=480
Column1:=590
Row2:=480
Column2:=940
rake (Image, RegionRakeP, (Column2-Column1), 50, 0.5, 1, 128, 'all', 'first',\
Row1, Column1, Row2, Column2, RowsP, ColsP)
*//找最上面的点
tuple_min (RowsP, RowsPMin)
tuple_find_first (RowsP, RowsPMin, RowsPMinI)
gen_cross_contour_xld (CrossP, RowsP[RowsPMinI], ColsP[RowsPMinI], 40, 0.785398)
*//线的rake范围
Row1L:=1620
Col1L:=426
Row2L:=1620
Col2L:=760
rake (Image, RegionRakeL, (Col2L-Col1L), 150, 0.5, 1, 10, 'all', 'first',\
Row2L, Col2L, Row1L, Col1L, RowsL, ColsL)
*//这里获得点后拟合一条直线
gen_contour_polygon_xld (ContL, RowsL, ColsL)
fit_line_contour_xld (ContL, 'tukey', -1, 0, 5, 2, RowBL, ColBL, RowEL, ColEL, Nr, Nc, Dist)
gen_contour_polygon_xld (ContL, [RowBL,RowEL], [ColBL,ColEL])
*//计算点到直线的垂直距离
get_pl_footpoint (RowsP[RowsPMinI], ColsP[RowsPMinI], RowBL, ColBL, RowEL, ColEL, RowF, ColF)
gen_arrow_contour_xld (ArrowRes, RowsP[RowsPMinI], ColsP[RowsPMinI], RowF, ColF, 20, 20)
distance_pl (RowsP[RowsPMinI], ColsP[RowsPMinI], RowBL, ColBL, RowEL, ColEL, Dis)
dev_clear_window ()
dev_display (Image)
dev_set_color ('red')
dev_display (CrossP)
dev_display (ContL)
dev_display (ArrowRes)
disp_message (WindowHandle, 'Res: '+Dis, 'window', 10, 10, 'red', 'false') |