Connected Components with even size kernel

220 Views Asked by At

I researched a bit about connected components. In either MATLAB or the OpenCV library, they always indicate that the kernel can be a 3x3 array and it can be either 4-connected or 8-connected. I did quite a bit of research but am unable to find an answer.

I know that a kernel can be in any shape. But in the connected components case, say, we have a 5x5 kernel, it can detect 1s even if they are in another label. (Due to size, 5x5 kernel can see 2 pixel area from anchor). And, say, we have 4x4 kernel (even sized kernel), in this case we don't even have an anchor. So my question is how can I apply connected component labeling with 4x4 and 5x5 kernels?

1

There are 1 best solutions below

0
On BEST ANSWER

Indeed, Connected Component Analysis (CCA) is usually applied with a 3x3 kernel, or rather, applied taking only the direct 4 or 8-connected neighbors as neighbors.

But one can choose larger neighborhoods to be considered connected. With a 5x5 kernel, gaps of one pixel in size can be ignored, making larger connected components.

To implement CCA with a larger kernel, one can apply a dilation to the image, apply a normal CCA, and then reset back to 0 those pixels that were 0 in the input image. The dilation should be of such a size that the desired gap size is filled. For the 5x5 kernel case, which ignores gaps of 1 pixel, we need to apply a 2x2 dilation to fill 1-pixel gaps.

Regarding the even-sized kernels: In general, such kernels have no problem. One can define the origin (anchor) anywhere one wishes. We always end up with an asymmetric kernel.

However, with CCA, it is unclear to me what the meaning would be of an asymmetric kernel. The neighbor two pixels to the right is connected, but the one two pixels to the left is not. This pixel B is connected to A, but A is not connected to B? Doesn’t seem to make sense to me. A connection definition must be symmetric to make sense. This is similar to the definition of a distance, which requires that distance(a,b)=distance(b,a).