My book says this about the Image Kernel concept in OpenCV
When a computation is done over a pixel neighborhood, it is common to represent this with a kernel matrix. This kernel describes how the pixels involved in the computation are combined in order to obtain the desired result.
In image blur techniques, we use the kernel size.
cv::GaussianBlur(inputImage,outputImage,Size(1,1),0,0)
So, if I say the kernel size is Size(1,1)
does that mean the kernel got only 1 pixel?
Please have a look at the following image
In here, what's the Kernel size? Size(3,3)
? If I say size Size(1,1)
in this image, does that mean the kernel got only 1 pixel and the pixel value is 0 (The first value in the image)?
The kernel size in the example image you gave is 3-by-3 (Size(3,3)
), yes. A kernel size of 1-by-1 is valid, although it wouldn't be very interesting.
The generic name for the operation being performed by GaussianBlur
is a convolution.
The GaussianBlur
function is creating a Gaussian kernel, which is basically a matrix that represents how you should combine a window of n-by-n pixels to get a single pixel value (using a Gaussian-shaped blurring pattern in this case).
A kernel of size 1-by-1 can't do anything other than scalar multiplication of an image; that is, convolution by the 1-by-1 matrix [c]
is just c * inputImage
.
Typically, you'll want to choose a n-by-n Gaussian kernel that satisfies:
Links:
The image you post is a 3x3 kernel, which would be specified by cv::Size(3,3)
. You are correct in saying that cv::Size(1,1)
corresponds to a single pixel, but saying "cv::Size(1,1)
" in reference to the image is not meaningful. A 1x1 kernel would simply have the value [1]
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With