跟我学机器视觉-HALCON学习例程中文详解-FUZZY检测用于开关引脚测量
* This example program demonstrates the basic usage of a fuzzy measure object. * Here, the task is to determine the width of and the distance between the * pins of a switch. * * First, read in the image and initialize the program. ***********************打开图像,获取图像宽度,高度*********************** read_image (Image, 'bin_switch/bin_switch_2') get_image_size (Image, Width, Height) p_reopen_window_fit (0, 0, Width, Height, 640, WindowHandle) p_set_font (WindowHandle) dev_display (Image) ************************显示图像如下:注意中间引脚反光**********************


gen_measure_rectangle2 (Row, Column, Phi, Length1, Length2, Width, Height, Interpolation, MeasureHandle) * * Determine all edge pairs that have a negative transition, i.e., edge pairs * that enclose dark regions. Sigma := 0.9 Threshold := 10 Transition := 'all' Select := 'all' **************进行测量,并显示检测结果,可以看出,中间的引脚检测结果不正确**** measure_pairs (Image, MeasureHandle, Sigma, Threshold, Transition, Select, RowEdgeFirst, ColumnEdgeFirst, AmplitudeFirst, RowEdgeSecond, ColumnEdgeSecond, AmplitudeSecond, IntraDistance, InterDistance) * * Visualize the results dev_display (Image) dev_set_draw ('margin') dev_set_color ('black') gen_rectangle2 (Rectangle, Row, Column, Phi, Length1, Length2) p_disp_dimensions (RowEdgeFirst, ColumnEdgeFirst, RowEdgeSecond, ColumnEdgeSecond, IntraDistance, InterDistance, Phi, Length2, WindowHandle) *

***************************放大后图像如下**************************************


* Free the memory that has been allocated for the measure. close_measure (MeasureHandle)
本站文章如无特殊说明,均为本站原创,如若转载,请注明出处:跟我学机器视觉-HALCON学习例程中文详解-FUZZY检测用于开关引脚测量 - Python技术站