Halcon-图像锐化(边缘处理)

sobel算子

*sobel算子
read_image (Image, 'claudia')
get_image_size (Image, Width, Height)
dev_close_window ()
dev_open_window_fit_size (0, 0, Width, Width, -1, -1, WindowHandle)
dev_display (Image)

rgb1_to_gray (Image, GrayImage)
sobel_amp (GrayImage, EdgeAmplitude, 'sum_abs', 3)
dump_window (WindowHandle, 'bmp', 'D:1/sobel_image')

sobel_amp (GrayImage, EdgeAmplitude, 'x', 3)
dump_window (WindowHandle, 'bmp', 'D:1/sobelx_image')

sobel_amp (GrayImage, EdgeAmplitude, 'y', 3)
dump_window (WindowHandle, 'bmp', 'D:1/sobely_image')

函数:sobel_amp (GrayImage, EdgeAmplitude, ‘sum_abs’, 3)

Halcon-图像锐化(边缘处理)_第1张图片

read_image (Image, 'patras')
dev_close_window ()
get_image_size (Image, Width, Height)
dev_open_window_fit_size (0, 0, Width, Width, -1, -1, WindowHandle)
sobel_amp (Image, EdgeAmplitude, 'sum_abs', 3)
threshold (EdgeAmplitude, Region, 30, 255)
skeleton (Region, Skeleton)
dev_set_color ('white')
dev_display (Image)
dev_display (Skeleton)

Halcon-图像锐化(边缘处理)_第2张图片

Roberts算子

read_image (Image, 'patras')
dev_close_window ()
get_image_size (Image, Width, Height)
dev_open_window_fit_size (0, 0, Width, Width, -1, -1, WindowHandle)
roberts (Image, ImageRoberts, 'roberts_max')
threshold (ImageRoberts, Region, 30, 255)
dump_window (WindowHandle, 'jpg', 'D:t')
skeleton (Region, Skeleton)
dev_set_color ('white')
dev_display (Image)
dev_display (Skeleton)

Halcon-图像锐化(边缘处理)_第3张图片
Prewitt算子

read_image (Image, 'patras')
dev_close_window ()
get_image_size (Image, Width, Height)
dev_open_window_fit_size (0, 0, Width, Width, -1, -1, WindowHandle)
prewitt_amp (Image, ImageEdgeAmp)
threshold (ImageEdgeAmp, Region, 30, 255)
skeleton (Region, Skeleton)
dev_set_color ('white')
dev_display (Image)
dev_display (Skeleton)

Halcon-图像锐化(边缘处理)_第4张图片
Kirsch算子

read_image (Image, 'patras')
dev_close_window ()
get_image_size (Image, Width, Height)
dev_open_window_fit_size (0, 0, Width, Width, -1, -1, WindowHandle)
kirsch_amp (Image, ImageEdgeAmp)
threshold (ImageEdgeAmp, Region, 30, 255)
skeleton (Region, Skeleton)
dev_set_color ('white')
dev_display (Image)
dev_display (Skeleton)

Halcon-图像锐化(边缘处理)_第5张图片
Canny算子

*Canny
read_image (Image, 'patras')
dev_close_window ()
get_image_size (Image, Width, Height)
dev_open_window_fit_size (0, 0, Width, Width, -1, -1, WindowHandle)
edges_image (Image, ImaAmp, ImaDir, 'canny', 0.5, 'nms', 12, 22)
threshold (ImaAmp, Region, 1, 255)
skeleton (Region, Skeleton)
gen_contours_skeleton_xld (Skeleton, Contours, 1, 'filter')
dev_set_color ('white')
dev_display (Image)
dev_display (Skeleton)

Halcon-图像锐化(边缘处理)_第6张图片

Laplace算子

*laplace算子
read_image (Image, 'can')
get_image_size (Image, Width, Height)
dev_close_window ()
dev_open_window_fit_size (0, 0, Width, Width, -1, -1, WindowHandle)
dev_display (Image)

rgb1_to_gray (Image, GrayImage)
laplace (GrayImage, ImageLaplace, 'absolute', 3, 'n_4')
dump_window (WindowHandle, 'bmp', 'D:1/laplace_image')

函数:laplace (GrayImage, ImageLaplace, ‘absolute’, 3, ‘n_4’)

Halcon-图像锐化(边缘处理)_第7张图片

你可能感兴趣的:(Halcon机器视觉,halcon,边缘检测)