本帖最后由 halcon2016 于 2026-1-20 20:04 编辑
- read_image (Image105930mzlpcacobc6jbv6v, 'C:/Users/Administrator/Desktop/105930mzlpcacobc6jbv6v.png')
- rgb1_to_gray(Image105930mzlpcacobc6jbv6v, GrayImage)
- threshold (GrayImage, Region, 30, 220)
- connection (Region, ConnectedRegions)
- select_shape (ConnectedRegions, Region1, 'area', 'and', 8, 18)
- union1 (Region1, RegionUnion)
- closing_rectangle1 (RegionUnion, RegionClosing1, 100, 100)
- gen_contour_region_xld (RegionClosing1, Contours, 'border')
- segment_contours_xld (Contours, ContoursSplit, 'lines', 5, 4, 2)
- select_contours_xld (ContoursSplit, SelectedContours1, 'contour_length', 500, 700, -0.5, 0.5)
- select_shape_xld (SelectedContours1, SelectedXLD1, ['row','orientation'], 'and', [63,-0.1], [820,0.1])
- select_shape_xld (SelectedContours1, SelectedXLD2, ['column','orientation'], 'and', [68,1.5], [825,3.4])
- concat_obj (SelectedXLD1, SelectedXLD2, ObjectsConcat)
- select_obj (ObjectsConcat, ObjectSelected1, [1,3,2,4])
- fit_line_contour_xld (ObjectSelected1, 'tukey', -1, 0, 5, 2, RowBegin, ColBegin, RowEnd, ColEnd, Nr, Nc, Dist)
- intersection_lines (RowBegin[0], ColBegin[0], RowEnd[0], ColEnd[0], RowBegin[1], ColBegin[1], RowEnd[1], ColEnd[1], Row1, Column1, IsOverlapping)
- intersection_lines (RowBegin[1], ColBegin[1], RowEnd[1], ColEnd[1], RowBegin[2], ColBegin[2], RowEnd[2], ColEnd[2], Row2, Column2, IsOverlapping)
- intersection_lines (RowBegin[2], ColBegin[2], RowEnd[2], ColEnd[2], RowBegin[3], ColBegin[3], RowEnd[3], ColEnd[3], Row3, Column3, IsOverlapping)
- intersection_lines (RowBegin[3], ColBegin[3], RowEnd[3], ColEnd[3], RowBegin[0], ColBegin[0], RowEnd[0], ColEnd[0], Row4, Column4, IsOverlapping)
- gen_cross_contour_xld (Cross, [Row1,Row2,Row3,Row4], [Column1,Column2,Column3,Column4], 16, 0.785398)
复制代码 |