read_image(Clip,'clip')
get_image_size(Clip,Width,Height)
dev_close_window()
dev_open_window(0,0,Width/2,Height/2,'black',WindowID)
dev_display(Clip)
set_display_font(WindowID,14,'mono','true', 'false')
disp_continue_message(WindowID,'black', 'true')
stop()
binary_threshold(Clip,Dark,'max_separability','dark', UsedThreshold)
connection(Dark,Single)
select_shape(Single,Selected,'area','and',5000,10000)
dev_set_draw('fill')
dev_set_colored(12)
disp_continue_message(WindowID,'black', 'true')
stop()
dev_display(Clip)
dev_set_color('green')
dev_display(Selected)
orientation_region(Selected,Phi)
area_center(Selected,Area,Row,Column)
dev_set_line_width(3)
dev_set_draw('margin')
Length:=80
dev_set_color('blue')
disp_arrow(WindowID, Row, Column, Row-Length*sin(Phi), Column+Length*cos(Phi), 4)
disp_message(WindowID,deg(Phi)$'3.1f'+'deg','image',Row,Column-100,'black','false')
09-17
1766
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountBlack.png)
11-02
1192
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountBlack.png)