Passive heave compensation
In image processing, a kernel, convolution matrix, or mask is a small matrix useful for blurring, sharpening, embossing, edge-detection, and more. This is accomplished by means of convolution between a kernel and an image.
Details
Depending on the element values, a kernel can cause a wide range of effects.
Original | ||
Edge-Detect | ||
Sharpen | ||
Blur* | ||
- *must be normalized
The above are just a few examples of effects achievable by convolving kernels and images.
Origin
The origin is the position of the kernel which is above (conceptually) the current output pixel. This could be outside of the actual kernel, though usually it corresponds to one of the kernel elements. For a symmetric kernel, the origin is usually the center element.
Convolution
This is a form of mathematical convolution.
The values of a given pixel in the output image are calculated by multiplying each kernel value by the corresponding input image pixel values. This can be described algorithmically with the following pseudo-code:
for each image row in output image: for each pixel in image row: set running total to zero for each kernel row in kernel: for each element in kernel row: multiply element value by corresponding* pixel value add result to running total set output image pixel to value of running total
- *corresponding input image pixels are found relative to the kernel's origin.
If the kernel is not symmetric, it has to be flipped both around it's horizontal and vertical axis before calculating the convolution as above.[1]
Edge Handling
Kernel convolution usually requires values from pixels outside of the image boundaries. There are a variety of methods for handling image edges.
- Extend
- The nearest border pixels are conceptually extended as far as necessary to provide values for the convolution. Corner pixels are extended in 90° wedges. Other edge pixels are extended in lines.
- Wrap
- The image is conceptually wrapped (or tiled) and values are taken from the opposite edge or corner.
- Crop
- Any pixel in the output image which would require values from beyond the edge is skipped. This method can result in the output image being slightly smaller, with the edges having been cropped.
Normalization
Dividing each element in the kernel by the sum of all the elements in the kernel. Normalization ensures that the pixel values in the output image are of the same relative magnitude as those in the input image.
External links
- vImage Programming Guide: Performing Convolution Operations
- Image Processing using 2D-Convolution
- GNU Image Manipulation Program - User Manual - 8.2. Convolution Matrix
- Interactive Demonstration of 3x3 Convolution Kernels
References
43 year old Petroleum Engineer Harry from Deep River, usually spends time with hobbies and interests like renting movies, property developers in singapore new condominium and vehicle racing. Constantly enjoys going to destinations like Camino Real de Tierra Adentro.
- Ludwig, Jamie (n.d.), "Image Convolution". Portland State University. http://web.pdx.edu/~jduh/courses/Archive/geog481w07/Students/Ludwig_ImageConvolution.pdf
- Lecarme, Olivier; Delvare, Karine (January 2013). The Book of GIMP: A Complete Guide to Nearly Everything. No Starch Press, p. 429, ISBN 978-1593273835.
- Gumster, Jason van; Shimonski, Robert (March 2012). GIMP Bible. Wiley, pp. 438–442, ISBN 978-0470523971.
- Stockman, George C.; Shapiro, Linda G. (February 2001). Computer Vision. Prentice Hall, pp. 53–54, ISBN 978-0130307965.