仅限参考
图(不是原图 是截图)
效果,取线交点(外面误差可以去掉)
线:
另一组图:
降噪代码:
read_image (Image, 'E:/gongsi/Project/ClothDetection/2019-11-02-Image/Image__2019-11-02__17-32-58.bmp')
rgb1_to_gray (Image, GrayImage)
get_image_size (GrayImage, Width, Height)
*创建高斯滤波器
gen_gauss_filter (ImageGauss, 1, 1, 0, 'none', 'dc_center', Width, Height)
gen_gauss_filter (ImageGauss1, 15, 15, 0, 'none', 'dc_center', Width, Height)
*空间域转频域图
fft_generic (GrayImage, ImageFFT, 'to_freq', -1, 'none', 'dc_center', 'complex')
*差分两个滤波器
sub_image (ImageGauss1, ImageGauss, ImageSub, 1,0)
*用滤波器对频域图进行卷积预算
convol_fft (ImageFFT, ImageSub, ImageConvol)
*频域图转空间域图
fft_generic (ImageConvol, ImageFFT1, 'from_freq', 1, 'none', 'dc_center', 'real')
*确定区域内矩形的灰度值范围cccc
gray_range_rect (ImageFFT1, ImageResult, 5,5)
*median_image
取线
mean_image (ImageResult, ImageResultImageResultH1, 100, 5)
*blob分析
threshold (ImageResultImageResultH1, Regions, 1.0e+008, 4.9e+008)
*'border_holes'
gen_contour_region_xld (Regions, ppp, 'border_holes')
select_shape_xld(ppp, AreaEdgesH, 'area', 'and', 3, 60000)
segment_contours_xld(AreaEdgesH,ContoursSplitH,'lines_circles', 5, 4, 2)
select_contours_xld (ContoursSplitH, SelectedContoursH, 'contour_length', 3, 25000, -0.5, 0.5)
*union_adjacent_contours_xld(SelectedContoursH, UnionContoursH, 3, 500, 'attr_keep')
*线拟合
union_collinear_contours_xld (SelectedContoursH, UnionCollinearContours, 400, 400, 50, 0.1, 'attr_forget')
select_contours_xld (UnionCollinearContours, UnionContoursH, 'contour_length', 2000, 25000, 0, 0)
*取线数据
area_center_points_xld(UnionContoursH, Area, Row, Column)
fit_line_contour_xld(UnionContoursH, 'tukey', -1, 0, 5, 2, RowBeginH, ColBeginH, RowEndH, ColEndH, Nr, Nc, Dist)
tuple_length(Area,Lengths)
取点
intersection_lines (RowEnd[i]-300, ColEnd[i], RowBegin[i]+300, ColBegin[i], RowEndH[j], ColEndH[j]-300, RowBeginH[j], ColBeginH[j]+300, R, C, IsOverlapping)