VisionPro CogIPOneImageTool工具 单幅图像处理工具
CogIPOeImageTool工具的功能原理
CogIPOneImageTool工具主要用来对单张图像进行算法处理操作,其内部封装许多图像处理算法。
1、加减常量
此算法为图像中的每一个像素点的像素值加上一个常量,创建一个新的图像,对于彩色图像,需要对每一个图层单独执行加碱操作。
2、3x3卷积运算
利用3X3核对图像执行卷积运算。
3、NxM卷积运算
利用NxM核对图像执行卷积运算,N、M可以任意设置。
4、均衡
对连续获得的图像进行重新映射,以使图像具有相同的灰度值,此算法主要用再光线有轻微变换时候,可以帮助你确保不相干的环境变换不会对系统的整体结果产生影响。
5、扩展
此算法可以通过放大系数对图像或图像一部分进行扩展,可以单独对X轴或Y轴进行扩展。
6、反转/旋转
此算法对图像或图像的一部分进行水平翻转或顺时针方向旋转。
7、高斯采样
对输入图像进行二次采样,使输出的图像只包含源图像的一部分像素,可以起到平滑图像的作用。
8、灰度形态调整
利用3x3核对输入图像进行灰度形态调整,根据特征的尺寸和方向有选择地增强或减弱模型特征。
9、NxM灰度形态调整
利用NxM核对图像进行灰度形态调整。
10、高通过滤
此算法先执行高斯平滑运算,然后用源图像减去高斯平滑后的图像,可以用此算法来增强图像中的重要特征。
11、3x3中值操作
3x3中值操作可以用来消除图像中的噪声,关于3x3中值操作的详细原理请参考相关书籍。此操作步需要设置任何参数,但要注意,此操作会减小图像的尺寸,每执行一次此操作,图像会减小2行2列。
12、丢失像素
将一些未知像素用固定的像素值替代,或根据对周围像素的分析确定一个替代值。
13、乘以常数
图像中的每一个像素点的像素值都乘以一个常数,如果常数值在0和1之间,则相对于除以一个大于1的值。如果是彩色图像,可以单独对每一个图层乘以常数。
14、量化
量化操作可以将具有相同灰度值的特征独立出来,或者是将想要的特征减小为某一个单独的像素值。
15、采样卷积
同时进行采样和卷积操作,可以起到平滑图像的作用。
The Image Processing One Image tool edit control allows you to choose the following image processing operations:
Operator | Description |
Add/Subtract Constant |
Add a positive or negative value to the grey value of each pixel in the greyscale image, generating an image that is artificially lighter or darker than the original. For input images of type CogImage24PlanarColor, values are added to Plane 0 (red), Plane 1 (green), and Plane 2 (blue). You might add a value so that the output image contains only the darkest features from the input image, as shown in the following example:
The following figure shows an example where the red component has been reduced by a high constant value:
You must also choose whether pixel values that fall below 0 or exceed 255 after the operation are allowed to wrap or be clamped to these limits. For example, in the case of a greyscale image, if you allow the values to wrap then a pixel with a grey value of 200 that has the value 100 added to it has the new value of 45 (200 + 100 - 255). If you choose to clamp the values then the same pixel does not exceed the value 255 after the operation. |
Convolve the input image with a 3x3 kernel of floating-point values. You can use this function, in conjunction with other image processing operators, to implement custom image processing operations, as shown in the following example:
Note that this operator always wraps output values rather than clamping them. |
|
Processing the image with a kernel of floating-point values of a size you specify. Use the NxM filter to perform a variety of image processing operations such as edge sharpening, edge detection, and edge softening, as shown in the following example:
|
|
Equalize | Remap the pixels in the image so that successive acquired images have similar grey values. Use an equalize operation when the lighting in your production environment can vary slightly from one image to the next, or when some aspect of the objects you are inspecting, such as color, are allowed to vary slightly. The equalize operation helps to ensure that irrelevant changes in your production environment do not impact the overall result of the vision application. |
Expand |
Enlarge the entire image, or a portion of the entire image, by a magnification factor that you specify. The operation accepts separate parameters for enlarging the image along the x-axis and the y-axis, so you can use the operation to magnify the input image along one direction only. For example, the following figure shows an input image and the image after it has been magnified by a factor of 5:
|
Flip/Rotate |
Perform a horizontal flip or a clockwise rotation on all or some portion of the input image. The following figure shows how a portion of an input image has been rotated 180 degrees:
You might need to flip or rotate an image so a vision tool analyzes the correct features each time the application executes, or to use the previously trained font characters of an OCV tool. |
Gauss Sampler |
Take a subsample of the input image so that the output image contains only a fraction of the original pixels, and smooth the input image by reducing the amount of contrast caused by frequent changes of light and dark pixels. For example, the following figure shows an image that has undergone a subsampling and smoothing operation:
Use a sampling operation when the vision tools you use work just as effectively on the reduced image and you want to increase the speed of your application. Use a smoothing operation to lessen the effect of liabilities such as texture, signal noise, or fine print in your images. In addition to sampling and smoothing, this operation allows you to include a magnitude shift factor for the output image, with a range of -7 through 7. Using negative values for the shift factor produces darker output images, while using positive values produces lighter output images. |
Perform grey scale morphology on the input image, selectively enhancing or reducing image features based on their size and orientation. See the section Grey-Scale Morphology for background information on this extensive image-processing operation. The following figure shows an image that has undergone a morphological operation:
|
|
Grey Morphology NxM | Perform grey scale morphology on the input image with a kernel of size NxM, selectively enhancing or reducing image features based on their size and orientation. See the section Grey-Scale Morphology for background information on this extensive image-processing operation. |
High Pass Filter |
You can perform a Gaussian, Mean or Median smoothing operation and then subtract the resulting image from the input image. The following figure shows an image after a High Pass filter has been applied:
Use a High Pass filter to accentuate fine features in the input image. |
Median 3x3 |
Reduce the effect of image noise in the input image by examining the 3x3 matrix of pixels around each original pixel, ranking them by order of grey values, and then taking the fifth, or middle grey value, for the output image. The following figure shows the effect of the median 3x3 operation:
The 3x3 Median operation takes no parameters. Be aware, however, that this operation reduces the size of the input image by 2 rows and 2 columns, or what is effectively a one-pixel strip around the border of the input image. If you use multiple 3x3 Median operations on the same image, the effect of this reduction multiplies. For example, if you use five 3x3 Median operations on an image, the output image will be 10 rows and 10 columns smaller than the original image. |
NxM Median |
Reduce the effect of image noise in the input image by examining the matrix of pixels around each original pixel using a kernel of custom size. Larger kernels have a greater effect at reducing image noise but can reduce the quality of features in the image. The NxM Median filter supports a masking kernel of Care and Don't Care pixels, allowing you to specify which elements of the matrix are not considered when generating the new grey value for the output image. Care pixels are enabled as shown in the following figure:
|
Missing Pixel |
Substitute pixels of unknown value with pixels of a fixed value or pixels whose values are based on the analysis of the surrounding pixels. Pixel values can be unknown based on how they are acquired. For example, range images from a DS1000 series sensor can contain missing pixels.
|
Multiply Constant |
Multiply the grey value of each pixel in the greyscale image by a constant value. For input images of type CogImage24PlanarColor, the values of Plane 0 (red), Plane 1 (green), and Plane 2 (blue) are multiplied by the multipliers you specify. If you specify a value between 0.0 and 1.0, it has the effect of dividing each pixel by a constant value, as shown in the following figure:
The following figure shows an example where the red component has been multiplied by a high value:
You must also choose whether resulting pixel values that fall below 0 or exceed 255 after the operation are allowed to wrap or be clamped to these limits. For example, if you allow the values to wrap then a pixel with a grey value of 200 that is multiplied by 2 has the new value of 145 (2 * 200 - 255). If you choose to clamp the values then the same pixel does not exceed the value 255 after the operation. |
Pixel Map |
Apply a pixel map to the input image. For greyscale input images, each pixel in the input image is replaced by a pixel with the value from the pixel map at the index that is equal to the input image pixel value. For images of type CogImage24PlanarColor, you can specify the individual pixel maps for Plane 0 (red), Plane 1 (green), and Plane 2 (blue). For example, if a greyscale input image pixel has a value of 73, it would be replaced by the value of the 73rd element of the pixel map. The following figure shows the effect of applying an inverted pixel map, where the pixel map contains values from 255 to 0:
The following figure shows the effect of applying an inverted Plane 0 (red) pixel map, where the Plane 0 pixel map contains values from 255 to 0:
Common applications for a pixel map include constructing mask images and performing customized image equalization. |
Quantize |
Reduce the number of discrete grey values in the input image. Performing a quantize operation can help separate individual features that have similar grey values, or reduce desired features to a single grey value, which can make them easier to analyze with other vision tools. The following figure shows the effect of the quantize operation:
When you select the quantize operation you must choose the number of discrete grey values the output image will contain. |
Sample Convolve |
Perform simultaneous separable convolution and sampling. A common use of this is downsampling with Gaussian smoothing. The following figure shows an image that has undergone a smoothing operation:
|
Subsampler |
Generate an output image where the input image has been reduced in resolution and size. Subsampling can allow other vision tools to operate faster on the reduced image, although reducing the image size can result in less accuracy. The Subsampler operation provides two types of algorithms for generating the output image. The first algorithm divides the input image into blocks of pixels and copies the pixel at the center of the block into the output image. If the block contains an even number of rows or columns, the operation copies the upper-left pixel closest to the center of the block. The following figure demonstrates subsampling with a 3x3 block:
The second algorithm the Subsampler operation offers is spatial averaging, which divides the input image into blocks of pixels, determines the average grey value of the pixels in each block, and places that average into the output image. The following figure demonstrates spatial averaging with a 2x2 block:
Between the two algorithms, the subsampling operation executes faster, but the spatial averaging algorithm offers a higher degree of accuracy. Note: If you specify an even number for the subsampling rate and you do not use spatial averaging, the tool selects the pixel above and to the left of the center of the sampling area. This introduces a one-half pixel shift in the locations of features in the sampled image. The tool automatically adjusts the output image coordinate space tree by shifting the coordinate space by one-half pixel. Because spatial averaging averages pixel values evenly across the sampling area regardless of its size, no such adjustment is performed when spatial averaging is enabled. |
No Operations | The tool can also be configured to use no image processing operations at all. In this case it simply applies the input region to the input image to produce an output image. This can be useful if you want to affine transform a region of pixels, or want to create a rectangular image this is a copy of some portion of the original input image. |
The following table summarizes the input image types the Image Processing One Image tool supports. The type of the output image will be the same as that of the input image.
Operation | Method | CogImage8Grey | CogImage16Grey | CogImage16Range | CogImage24PlanarColor |
Add/Subtract Constant | ✔ | ✔ | ✔ | ||
Convolve3x3 | ✔ | ✔ | |||
Convolve NxM | ✔ | ✔ | |||
Equalize | ✔ | ✔ | |||
Expand | ✔ | ✔ | ✔ | ||
Flip/Rotate | ✔ | ✔ | ✔ | ||
Gauss Sampler | ✔ | ✔ | |||
Grey Morphology | ✔ | ||||
NxM Grey Morphology | ✔ | ||||
High Pass Filter | |||||
Gauss | ✔ | ✔ | ✔ | ||
Mean | ✔ | ✔ | ✔ | ✔ | |
Median | ✔ | ✔ | ✔ | ✔ | |
3x3 Median | ✔ | ||||
Median NxM | ✔ | ✔ | ✔ | ||
Missing Pixel | ✔ | ||||
Multiply Constant | ✔ | ✔ | ✔ | ||
Pixel Map | ✔ | ✔ | |||
Quantize | ✔ | ✔ | |||
Sample Convolve | ✔ | ✔ | |||
Subsampler | ✔ | ✔ | ✔ |