功能:边缘检测,使用FFT+Gauss进行预处理
THIK:边缘检测的大体流程就是这样,出于保密原因所以没给图

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
get_image_size(Image, Width, Height)
gen_rectangle2 (ROI_0, 1875.79, 1389.2, rad(-86.348), 1165.25, 456.347)

* FFT+gauss
optimize_rft_speed (Width, Height, 'standard')

Sigma1 := 20
Sigma2 := 3
gen_gauss_filter (GaussFilter1, Sigma1, Sigma1, 0.0, 'none', 'rft', Width, Height)
gen_gauss_filter (GaussFilter2, Sigma2, Sigma2, 0.0, 'none', 'rft', Width, Height)
sub_image (GaussFilter1, GaussFilter2, Filter, 1, 0)

rft_generic (Image, ImageFFT, 'to_freq', 'none', 'complex', Width)
convol_fft (ImageFFT, Filter, ImageConvol)
rft_generic (ImageConvol, ImageFiltered, 'from_freq', 'n', 'real', Width)


* 边缘检测
reduce_domain (ImageFiltered, ROI_0, ImageReduced)
edges_sub_pix (ImageReduced, Edges, 'canny', 10, 10, 35)

* 筛选边缘
smooth_contours_xld (Edges, SmoothedContours1, 511)
select_contours_xld (SmoothedContours1, SelectedContours1, 'contour_length', 100, 2000000, -0.5, 0.5)
union_adjacent_contours_xld (SelectedContours1, UnionContours1, 100, 1, 'attr_keep')
select_contours_xld (UnionContours1, SelectedContours, 'contour_length', 1000, 2000000, 0, 0)

union_adjacent_contours_xld (SelectedContours, UnionContours, 400, 0.1, 'attr_keep')

dev_clear_window()
dev_display (Image)
dev_display (SelectedContours)