dev_set_draw('margin')
dev_set_line_width(3)
**************************
***创建包含了检测的边缘ROI区域,注意所画的矩形区域的长轴要与检测边界垂直
**************************
Row := 599.5
Column := 1073.5
Phi := rad(-87.0643)
Length1 := 351.461
Length2 := 75.0125
Interpolation := 'nearest_neighbor'
gen_rectangle2(ROI, 599.5, 1073.5, rad(-87.0643), 351.461, 75.0125)
**************************
***创建测量对象
**************************
gen_measure_rectangle2 (Row, Column, Phi, Length1, Length2, Width, Height, Interpolation, MeasureHandle)
disp_continue_message (WindowHandle, 'black', 'true')
*********
******边缘检测算子的参数
******图像对象 、检测对象、 高斯平滑值、 最小的边缘宽度、边缘的灰度变化的形式、
********measure_pairs是边缘检测的算法,高斯平滑之后,设置灰度值的变化形式,以及边缘的宽度
measure_pairs (Image, MeasureHandle, 1, 1, 'negative', 'all', RowEdgeFirst, ColumnEdgeFirst, AmplitudeFirst, RowEdgeSecond, ColumnEdgeSecond, AmplitudeSecond, IntraDistance, InterDistance)
disp_continue_message (WindowHandle, 'black', 'true')
disp_cross(WindowHandle, RowEdgeSecond, ColumnEdgeSecond, 3, 0)
disp_cross(WindowHandle, RowEdgeFirst, ColumnEdgeFirst, 3, 0)
*************
***结果可视化
****************
for i := 0 to |RowEdgeFirst|-1 by 1
gen_contour_polygon_xld (EdgeFirst, [-sin(Phi+rad(90))*Length2+RowEdgeFirst[i], -sin(Phi-rad(90))*Length2+RowEdgeFirst[i]], [cos(Phi+rad(90))*Length2+ColumnEdgeFirst[i], cos(Phi-rad(90))*Length2+ColumnEdgeFirst[i]])
gen_contour_polygon_xld (EdgeSecond, [-sin(Phi+rad(90))*Length2+RowEdgeSecond[i], -sin(Phi-rad(90))*Length2+RowEdgeSecond[i]], [cos(Phi+rad(90))*Length2+ColumnEdgeSecond[i], cos(Phi-rad(90))*Length2+ColumnEdgeSecond[i]])
dev_set_color ('cyan')
dev_display (EdgeFirst)
dev_set_color ('magenta')
dev_display (EdgeSecond)
dev_set_color ('blue')
if (i = 0)
set_tposition ( WindowHandle, RowEdgeFirst[i] + 5, ColumnEdgeFirst[i]+20)
else
set_tposition ( WindowHandle, RowEdgeFirst[i] - 40, ColumnEdgeFirst[i]+20)
endif
write_string ( WindowHandle, 'width: '+IntraDistance[i]+' pix')
endfor
disp_continue_message ( WindowHandle, 'black', 'true')
stop ()
close_measure (MeasureHandle)
dev_update_window ('on')
dev_clear_window ()