read_image(Image, 'C:/Users/86173/Desktop/test/4.png')
get_image_size(Image, Width, Height)
dev_close_window()
dev_open_window(0, 0, Width, Height, 'black', WindowHandle)
dev_display(Image)
rgb1_to_gray(Image, GrayImage)
gray := 88
threshold(GrayImage, Region, gray, 255) //全局阈值
binary_threshold(GrayImage, Region1, 'max_separability', 'dark', UsedThreshold) //将灰度图像转换为二值图像的函数
mean_image(GrayImage, ImageMean, 15, 15) //均值滤波(计算图像像素值的平均值的函数)
dyn_threshold(GrayImage, ImageMean, RegionDynThresh, 15, 'light') //动态阈值(根据局部图像信息动态计算阈值的函数。它使用自适应算法来确定每个像素的最佳阈值,从而创建更准确和鲁棒的二值图像)
HalconLen5-全局与动态阈值和均值滤波
最新推荐文章于 2024-05-23 14:37:15 发布