Halcon(图像预处理)
read_image (Image,'data/codes.jpg')
rgb1_to_gray (Image, GrayImage)
threshold (GrayImage, DarkArea, 0, 128)
read_image (Image,'data/shapes')
rgb1_to_gray (Image, GrayImage)
auto_threshold(GrayImage,Regions,8.0)
read_image (Image, 'data/codes.jpg')
rgb1_to_gray (Image, GrayImage)
binary_threshold (GrayImage, RegionMaxSeparabilityLight, 'max_separability', 'dark', UsedThreshold)
read_image (Image, 'data/text.jpg')
*将图像转换为灰度
rgb1_to_gray (Image, GrayImage)
*由于图像对比度比较低,对图像进行相乘,增强对比度
mult_image (GrayImage, GrayImage, ImageResult, 0.005, 0)
*使用平滑滤波器对原始图像进行适当平滑
mean_image (ImageResult, ImageMean, 50,50)
*动态阈值分割,提取字符区域
dyn_threshold (ImageResult, ImageMean, RegionDynThresh, 4, 'not_equal')
*开运算,去除无意义的小的杂点
opening_circle (RegionDynThresh, RegionOpening, 1.5)
dev_clear_window()
dev_display (RegionOpening)
read_image (Image,'data/holes.jpg')
rgb1_to_gray (Image, GrayImage)
*设置矩形,选择感兴趣区域
gen_rectangle1 (Rectangle, 170, 80, 370, 510)
reduce_domain (GrayImage, Rectangle, ImageReduced)
var_threshold (ImageReduced, Region, 15, 15, 0.2, 35, 'dark')
read_image (Char, 'data/char')
rgb1_to_gray (Char, GrayImage)
char_threshold (GrayImage, GrayImage, Characters, 6, 95, Threshold)
dual_threshold(Image : RegionCrossings : MinSize, MinGray, Threshold :)
read_image(Image,'data/village')
*对原图进行了均值处理,选用了5*5的滤波器
mean_image(Image,Mean,5,5)
*使用了区域生长算子寻找颜色相似的邻域
regiongrowing(Mean,Regions,1,1,3.0,100)
*对提取区域做了形态学处理,使区域更加平滑和完整
closing_circle (Regions, RegionClosing, 3.5)
read_image (Image, 'data/village')
*对原图进行了均值处理,选用了“circle”类型的中值滤波器
median_image (Image, ImageMedian, 'circle', 2, 'mirrored')
*使用了区域生长算子寻找颜色相似的邻域
regiongrowing (ImageMedian, Regions, 1, 1, 3, 500)
*对图像进行粗略的区域分割,提取满足条件的各个独立区域
shape_trans (Regions, Centers, 'inner_center')
connection (Centers, SingleCenters)
*对初步提取的区域计算出了中心点坐标
area_center (SingleCenters, Area, Row, Column)
*以均值灰度图像为输入,进行区域生长计算,计算的起始坐标为上一步的各区域中心
regiongrowing_mean (ImageMedian, RegionsMean, Row, Column, 25, 100)
*输入待检测的木材图像
read_image (Image, 'data/woodboard')
*将原始图转化为灰度图。便与后续的平滑处理
rgb1_to_gray (Image, GrayImage)
*对单通道图像进行高斯平滑处理,以去除噪声
gauss_filter (GrayImage, ImageGauss, 11)
*对高斯平滑后的图像进行分水岭处理,阈值分割,提取出盆地区域
watersheds (ImageGauss, Basins1, Watersheds)
watersheds_threshold(ImageGauss, Basins, 50)