勇哥注:
图片过滤器是一切缺陷检测、边缘提取、图片分割前处理、分类器应用等等的基础。有很重要的研究意义。
因此勇哥会写成一个系列贴子以和大家一起分享。
-正文---------------------------------------------------------------------
下面是官方文档,勇哥把它编辑了一下做为本系列贴子的第一篇。
它先介绍一下halcon的过滤器使用reduce_domain图像要注意的问题。
最后再介绍halcon的全部常见的过滤器(按功能分类)
图像过滤器应用reduce domain图像的问题
过滤器几乎是每个机器视觉应用程序的重要组成部分。例如,
可用于平滑图像, mean_image
提取子像素的精确边缘以及edges_sub_pix
计算图像的快速傅立叶变换。 fft_image
在下面的内容中,我们将仔细研究特殊情况:将具有reduce domain的图像用作滤镜的输入,以及由图像域外部的灰度值引起的问题。
图像滤镜,蒙版和reduced domain缩小域
如果将使用蒙版的滤镜应用于reduced domain的图像,则沿域边界的结果可能会令人吃惊,因为位于边界外部的灰度值用作滤波过程的输入。要理解这一点,您必须在以下情况下考虑域的定义:对于过滤器,域定义了必须为哪些输入像素计算输出像素。但是可以将域外的像素(位于图像矩阵内)用于处理。
由Image域外部的灰度值引起的问题
将图像作为输出的运算符(大多数过滤器运算符)仅返回输入域中包含的像素的结果。
出于性能原因,位于图像域之外的像素将变为“未定义”。这些未定义的像素可能因系统而异,例如,是否激活并行化。如果在具有相同配置的系统上重复执行该程序,则仅保证值是一致的。在某些情况下,这些“未定义”像素可能会导致问题。使用命令
将生成的图像扩展到整个域会导致伪像出现在先前的图像域之外。full_domain
导致问题的另一个原因是,如果连续应用两个或多个过滤器,则域外的未定义值也会被应用,因为这些过滤器也会将未定义值视为靠近域边界。这意味着从后面到中间,每个后续过滤器的误差都会增加。
在下文中,提出了解决这些问题的四种策略。
应用两个连续的过滤器后,在域边界的伪影。
例如,通过选择一个比实际需要的图像部分大很多的域,可以轻松地防止由未定义像素引起的错误。过滤器应用后,可以将图像域缩小到其原始大小(例如,使用
和erosion_rectangle1
)。这样做会切除图像中包含不正确值的那些部分,因此不会增加下一个滤镜操作的误差。 reduce_domain
另一个选择是将域完全设置为图像中感兴趣部分的大小,然后在应用滤镜之前调用运算符
。此运算符将边界内的像素复制到边界外,因此避免了由域外未定义的像素引起的错误。随后,可以再次将域减小到其原始大小。接下来的每个过滤器操作都应重复此过程。但是请注意,此选项会大大增加运行时间。 expand_domain_gray
看起来
的结果就像边界被多次复制并在外部添加一样。 expand_domain_gray
1. 如果运行时不是问题,则可以在将第一个过滤器应用于图像之前调用
运算符。这样,整个图像被定义为域,并且完全避免了未定义的像素。 full_domain
2. 获得没有未定义像素的图像的另一种可能性是通过在应用滤镜之前调用crop_domain
运算符。操作员将图像裁剪为域的大小,这意味着域将覆盖完整的较小图像。但是请注意,对于裁剪后的图像,坐标系相对于原始图像已更改,这将影响所有后续应用程序,具体取决于图像坐标系(例如,计算重心)。 crop_domain
halcon的常见过滤器(按功能分类)
(一)Arithmetic (算术)
Calculate the absolute difference of two images.
Calculate the absolute value (modulus) of an image.
Calculate the arccosine of an image.
Add two images.
Calculate the arcsine of an image.
Calculate the arctangent of two images.
Calculate the arctangent of an image.
Calculate the cosine of an image.
Divide two images.
Calculate the exponentiation of an image.
Perform a gamma encoding or decoding of an image.
Invert an image.
Calculate the logarithm of an image.
Calculate the maximum of two images pixel by pixel.
Calculate the minimum of two images pixel by pixel.
Multiply two images.
Raise an image to a power.
Scale the gray values of an image.
Calculate the sine of an image.
Calculate the square root of an image.
Subtract two images.
Calculate the tangent of an image.
(二)Bit (位)
Bit-by-bit AND of all pixels of the input images.
Left shift of all pixels of the image.
Logical “AND” of each pixel using a bit mask.
Complement all bits of the pixels.
Bit-by-bit OR of all pixels of the input images.
Right shift of all pixels of the image.
Extract a bit from the pixels.
Bit-by-bit XOR of all pixels of the input images.
(三)Color (颜色)
Color space transformation using pre-generated look-up-table.
Convert a single-channel color filter array image into an RGB image.
Release the look-up-table needed for color space transformation.
Creates the look-up-table for transformation of an image from the RGB color space to an arbitrary color space.
Compute the transformation matrix of the principal component analysis of multichannel images.
Compute an affine transformation of the color values of a multichannel image.
Compute the principal components of multichannel images.
Transform an RGB image into a gray scale image.
Transform an RGB image to a gray scale image.
Transform an image from the RGB color space to an arbitrary color space.
Transform an image from an arbitrary color space to the RGB color space.
(四)Edges (边缘)
Close edge gaps using the edge amplitude image.
Close edge gaps using the edge amplitude image.
Convolve an image with derivatives of the Gaussian.
Approximate the LoG operator (Laplace of Gaussian).
Extract color edges using Canny, Deriche, or Shen filters.
Extract subpixel precise color edges using Deriche, Shen, or Canny filters.
Extract edges using Deriche, Lanser, Shen, or Canny filters.
Extract sub-pixel precise edges using Deriche, Lanser, Shen, or Canny filters.
Detect edges (amplitude) using the Frei-Chen operator.
Detect edges (amplitude and direction) using the Frei-Chen operator.
Extract high frequency components from an image.
Return the filter coefficients of a filter in
.edges_image
Detect edges (amplitude) using the Kirsch operator.
Detect edges (amplitude and direction) using the Kirsch operator.
Calculate the Laplace operator by using finite differences.
LoG-Operator (Laplace of Gaussian).
Detect edges (amplitude) using the Prewitt operator.
Detect edges (amplitude and direction) using the Prewitt operator.
Detect edges using the Roberts filter.
Detect edges (amplitude) using the Robinson operator.
Detect edges (amplitude and direction) using the Robinson operator.
Detect edges (amplitude) using the Sobel operator.
Detect edges (amplitude and direction) using the Sobel operator.
(五)Enhancement (增强功能)
Perform a coherence enhancing diffusion of an image.
Enhance contrast of the image.
Histogram linearization of images
Illuminate image.
Apply the mean curvature flow to an image.
Maximum gray value spreading in the value range 0 to 255.
Apply a shock filter to an image.
(六)FFT (快速傅立叶变换)
Convolve an image with a filter in the frequency domain.
Convolve an image with a Gabor filter in the frequency domain.
Compute the correlation of two images in the frequency domain.
Deserialize FFT speed optimization data.
Calculate the energy of a two-channel image.
Compute the fast Fourier transform of an image.
Compute the fast Fourier transform of an image.
Compute the inverse fast Fourier transform of an image.
Generate an ideal band filter.
Generate an ideal bandpass filter.
Generate a derivative filter in the frequency domain.
Store a filter mask in the spatial domain as a real-image.
Generate a Gabor filter.
Generate a Gaussian filter in the frequency domain.
Generate an ideal highpass filter.
Generate an ideal lowpass filter.
Generate a mean filter in the frequency domain.
Generate a bandpass filter with sinusoidal shape.
Generate a bandpass filter with Gaussian or sinusoidal shape.
Optimize the runtime of the FFT.
Optimize the runtime of the real-valued FFT.
Compute the phase correlation of two images in the frequency domain.
Return the phase of a complex image in degrees.
Return the phase of a complex image in radians.
Return the power spectrum of a complex image.
Return the power spectrum of a complex image.
Return the power spectrum of a complex image.
Load FFT speed optimization data from a file.
Compute the real-valued fast Fourier transform of an image.
Serialize FFT speed optimization data.
Store FFT speed optimization data in a file.
(七)Geometric Transformations (几何变换)
对图像应用任意仿射二维变换.
对图像应用任意仿射二维变换并指定输出图像大小.
将图像贴图转换为其他贴图类型.
Apply a general transformation to an image.
Mirror an image.
Transform an annular arc in an image to polar coordinates.
Transform an image in polar coordinates back to cartesian coordinates
Apply a projective transformation to an image.
Apply a projective transformation to an image and specify the output image size.
Rotate an image about its center.
Zoom an image by a given factor.
Zoom an image to a given size.
(八)Inpainting (修补)
Perform a harmonic interpolation on an image region.
Perform an inpainting by anisotropic diffusion.
Perform an inpainting by coherence enhancing diffusion.
Perform an inpainting by coherence transport.
Perform an inpainting by smoothing of level lines.
Perform an inpainting by texture propagation.
(九)Lines (线)
Edge extraction using bandpass filters.
Detect color lines and their width.
Detection of lines using the facet model.
Detect lines and their width.
(十)Match (匹配)
Matching of a template and an image.
Matching a template and an image in a resolution pyramid.
Calculating a Gauss pyramid.
Calculating the monotony operation.
(十一)Misc (杂项)
Calculate the correlation between an image and an arbitrary filter mask
Calculate standard deviation over several channels.
Expand the domain of an image and set the gray values in the expanded domain.
Calculate the lowest possible gray value on an arbitrary path to the image border for each point in the image.
Thinning of gray value images.
Transform an image with a gray-value look-up-table
Symmetry of gray values along a row.
Compute the topographic primal sketch of an image.
(十二)Noise (噪声)
Add noise to an image.
Add noise to an image.
Generate a Gaussian noise distribution.
Determine the noise distribution of an image.
Generate a salt-and-pepper noise distribution.
(十三)Optical Flow (光流)
Convolve a vector field with derivatives of the Gaussian.
Compute the optical flow between two images.
Unwarp an image using a vector field.
Compute the length of the vectors of a vector field.
(十四)Points (点)
Searching corners in images.
Enhance circular dots in an image.
Detect points of interest using the Förstner operator.
Detect points of interest using the Harris operator.
Detect points of interest using the binomial approximation of the Harris operator.
Detect points of interest using the Lepetit operator.
Find corners using the Sojka operator.
(十五)Scene Flow (场景流)
Compute the calibrated scene flow between two stereo image pairs.
Compute the uncalibrated scene flow between two stereo image pairs.
(十六)Smoothing (平滑处理)
图像平滑介绍
Perform an anisotropic diffusion of an image.
bilateral filtering of an image.
Smooth an image using the binomial filter.
Smooth an image in the spatial domain to suppress noise.
Replace values outside of thresholds with average value.
Interpolate 2 video half images.
Smooth using discrete gauss functions.
Guided filtering of an image.
Information on smoothing filter
.smooth_image
Perform an isotropic diffusion of an image.
Smooth by averaging.
Average gray values over several channels.
Suppress salt and pepper noise.
Compute a median filter with various masks.
Compute a median filter with rectangular masks.
Separated median filtering with rectangle masks.
Weighted median filtering with different rank masks.
Calculate the average of maximum and minimum inside any mask.
Compute a rank filter with arbitrary masks.
Return gray values with given rank from multiple channels.
Compute a rank filter with rectangular masks.
Non-linear smoothing with the sigma filter.
Smooth an image using various filters.
Smooth an image with an arbitrary rank mask.
(十七)Texture Inspection (纹理检查)
Calculate the standard deviation of gray values within rectangular windows.
Calculate the entropy of gray values within a rectangular window.
Filter an image using a Laws texture filter.
(十八)Wiener Filter (维纳过滤器)
Generate an impulse response of an uniform out-of-focus blurring.
Generate an impulse response of a (linearly) motion blurring.
Simulate an uniform out-of-focus blurring of an image.
Simulation of (linearly) motion blur.
Image restoration by Wiener filtering.
Image restoration by Wiener filtering.

