dev_update_off ()
*
* step: acquire image
*
read_image (Image, 'die_on_chip')
get_image_size (Image, Width, Height)
dev_close_window ()
dev_open_window (0, 0, Width * 2, Height * 2, 'light gray', WindowID)
dev_set_part (0, 0, Height - 1, Width - 1)
dev_set_line_width (3)
dev_set_color ('white')
dev_display (Image)
set_display_font (WindowID, 16, 'mono', 'true', 'false')
*
* step: extract contours for the die
*
* step: create ROI
*
dev_set_line_width (2)
dev_set_draw ('fill')
fast_threshold (Image, Region, 120, 255, 20)
opening_rectangle1 (Region, RegionOpening, 4, 4)
connection (RegionOpening, ConnectedRegions)
fill_up (ConnectedRegions, RegionFillUp)
select_shape (RegionFillUp, SelectedRegions, ['rectangularity','area'], 'and', [0.8,700], [1,99999])
smallest_rectangle2 (SelectedRegions, Row, Column, Phi, Length1, Length2)
gen_rectangle2 (Rectangle, Row, Column, Phi, Length1, Length2)
boundary (Rectangle, RegionBorder, 'inner_filled')
dilation_rectangle1 (RegionBorder, RegionDilation, 4, 4)
reduce_domain (Image, RegionDilation, ImageReduced)
dev_clear_window ()
dev_display (ImageReduced)
disp_continue_message (WindowID, 'black', 'true')
stop ()
*
* step: create contours
*
edges_sub_pix (ImageReduced, Edges, 'canny', 1.5, 30, 40)
segment_contours_xld (Edges, ContoursSplit, 'lines', 5, 2, 2)
select_contours_xld (ContoursSplit, SelectedContours1, 'contour_length', 10, 99999, -0.5, 0.5)
union_adjacent_contours_xld (SelectedContours1, UnionContours1, 30, 1, 'attr_keep')
*
* step: fit rectangle
*
fit_rectangle2_contour_xld (UnionContours1, 'tukey', -1, 0, 0, 3, 2, Row1, Column1, Phi1, Length11, Length12, PointOrder1)
gen_rectangle2_contour_xld (Rectangle1, Row1, Column1, Phi1, Length11, Length12)
*