文章目录

  • 图像增强
  • 直方图归一化
  • 增强图像对比度
  • 边缘增强
  • 灰度值拉伸
  • 图像平滑去噪
  • 均值滤波
  • 中值滤波
  • 高斯滤波
  • 图像分割
  • 阈值处理
  • 区域生长
  • 分水岭
  • 形态学
  • 膨胀
  • 腐蚀
  • 开运算
  • 闭运算
  • 顶帽运算
  • 底帽运算:
  • 灰度形态学


图像增强

HALCON Operator Reference / Filters / Enhancement

直方图归一化

  1. equ_histo_image
read_image (Image, 'mvtec_logo')
* 直方图归一化
equ_histo_image (Image, ImageEquHisto)

增强图像对比度

  1. emphasize
read_image (Image, 'mvtec_logo')
* 增强对比度
emphasize (Image, ImageEmphasize, 7, 7, 1)
  1. illuminate
read_image (Image, 'mvtec_logo')
* 增强对比度
illuminate (Image, ImageIlluminate, 40, 40, 0.55)

边缘增强

  1. shock_filter
    冲击滤波器,对于边缘模糊的很有用,缺点速度慢
read_image (Image, 'mvtec_logo')
* 增强边缘
shock_filter  (Image, SharpenedImage, 0.5, 10, 'canny', 1)

灰度值拉伸

  1. scale_image_max
    灰度值拉伸到0-255
read_image (Image, 'mvtec_logo')
* 灰度值拉伸到0-255
scale_image_max (Image, ImageScaleMax)

图像平滑去噪

HALCON Operator Reference / Filters / Smoothing

均值滤波

  1. mean_image
read_image (Image, 'mvtec_logo')
* 均值滤波
mean_image (Image, ImageMean, 9, 9)

中值滤波

  1. median_image
read_image (Image, 'mvtec_logo')
* 中值滤波
median_image (Image, ImageMedian, 'circle', 5, 'mirrored')

高斯滤波

  1. gauss_filter
read_image (Image, 'mvtec_logo')
* 高斯滤波
gauss_filter (Image, ImageGauss, 5)

图像分割

HALCON Operator Reference / Segmentation

阈值处理

HALCON Operator Reference / Segmentation / Threshold

  1. threshold
    全局阈值分割
read_image (Image, 'mvtec_logo')
* 全局阈值分割
threshold (Image, Region, 0, 128)
  1. auto_threshold
    根据直方图分割
read_image (Image, 'mvtec_logo')
* 阈值分割
auto_threshold (Image, Regions, 2)
  1. binary_threshold
    自动全局阈值分割
read_image (Image, 'mvtec_logo')
* 自动全局阈值分割
binary_threshold (Image, Region, 'max_separability', 'dark', UsedThreshold)
  1. dyn_threshold
    动态阈值分割
read_image (Image, 'mvtec_logo')
* 动态阈值分割,需要配合mean_image, binomial_filter, gauss_filter,等平滑图像 
mean_image (Image, ImageMean, 9, 9)
dyn_threshold (Image, ImageMean, RegionDynThresh, 10, 'dark')

区域生长

HALCON Operator Reference / Segmentation / Region Growing

  1. regiongrowing
read_image (Image, 'mvtec_logo')
* 区域生长
mean_image(Image,Mean,3,3)
regiongrowing (Mean, Regions, 3, 3, 6, 100)

分水岭

HALCON Operator Reference / Segmentation / Topography

  1. watersheds_threshold
read_image (Image, 'mvtec_logo')
* 先检测边缘
gauss_filter (Image, ImageGauss, 9)
sobel_amp (ImageGauss, EdgeAmplitude, 'sum_abs', 3)
* 分水岭
watersheds_threshold  (EdgeAmplitude, Basins, 10)

形态学

HALCON Operator Reference / Morphology / Region

膨胀

  1. dilation_circle
read_image (Image, 'mvtec_logo')
* 图像阈值分割
binary_threshold  (Image, Region, 'max_separability', 'dark', UsedThreshold)
* 膨胀
dilation_circle (Region, RegionDilation, 5.5)

腐蚀

  1. erosion_circle
read_image (Image, 'mvtec_logo')
* 图像阈值分割
binary_threshold  (Image, Region, 'max_separability', 'dark', UsedThreshold)
* 腐蚀
erosion_circle (Region, RegionErosion, 5.5)

开运算

先腐蚀后膨胀

  1. opening_circle

Halcon深度学习 对象检测 halcon deep learning tool_Image

read_image (Image, 'mvtec_logo')
* 图像阈值分割
binary_threshold  (Image, Region, 'max_separability', 'dark', UsedThreshold)
* 开运算
opening_circle (Region, RegionOpening, 5.5)

闭运算

先膨胀后腐蚀

  1. closing_circle
read_image (Image, 'mvtec_logo')
* 图像阈值分割
binary_threshold  (Image, Region, 'max_separability', 'dark', UsedThreshold)
* 闭运算
closing_circle (Region, RegionClosing, 1.5)

顶帽运算

源区域 - 开运算区域

  1. top_hat
read_image (Image, 'mvtec_logo')
* 图像阈值分割
binary_threshold  (Image, Region, 'max_separability', 'dark', UsedThreshold)
* 顶帽
gen_rectangle1 (Rectangle1, 0, 0, 5, 5)
top_hat (Region, Rectangle1, RegionTopHat)

底帽运算:

源区域 - 闭运算区域

  1. bottom_hat
read_image (Image, 'mvtec_logo')
* 图像阈值分割
binary_threshold  (Image, Region, 'max_separability', 'dark', UsedThreshold)
* 底帽
gen_circle (Circle, 1.5, 1.5, 1.5)
bottom_hat (Region, Circle, RegionBottomHat)

灰度形态学

HALCON Operator Reference / Morphology / Gray Values

  1. gray_dilation
read_image (Image, 'mvtec_logo')
get_image_size (Image, Width, Height)
gen_rectangle1 (Rectangle, 0, 0, Height-1,Width-1)
* 构造一个圆形定义域作为结构元素
gen_image_const (ConstImage, 'byte', 11, 11)
get_image_size (ConstImage, MaskWidth, MaskHeight)
gen_circle (Circle, (MaskHeight - 1) / 2.0, (MaskWidth - 1) / 2.0, 5)
reduce_domain (ConstImage, Circle, ImageReduced)
* 灰度膨胀
gray_dilation (Image, ImageReduced, ImageDilation)
  1. gray_erosion
read_image (Image, 'mvtec_logo')
* 构造一个圆形定义域作为结构元素
gen_image_const (ConstImage, 'byte', 11, 11)
get_image_size (ConstImage, MaskWidth, MaskHeight)
gen_circle (Circle, (MaskHeight - 1) / 2.0, (MaskWidth - 1) / 2.0, 5)
reduce_domain (ConstImage, Circle, ImageReduced)
* 灰度腐蚀
gray_erosion (Image, ImageReduced, ImageErosion)

……