Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This comment is hidden because it contains spoiler information about the solution
I strongly agree. I had to make 3 different attempts -- each with a different set of assumptions of what the author might ask me to do -- before I was able to complete this Kata.
That's exactly right! Those groups are called "4-connected components" in this kata (and in topological image processing). Now you can try to solve it to consolidate the theory :)
It counts as one, since every point inside the component can be reached from every other point. I know it can be confusing, but every point can be reached from itself, and since the maximal set of points that constitute the connected component is formed by only one point, then all the points can be reached from every other point in the component (strictly speaking).
It's important to note that the set of points must be maximal, meaning that an image cannot have a connected component that is a subset of another component.
Maybe I misunderstood it @Dr Gabo, but I'm assuming this would count as 1 component, no ?
If not, are there any tests for this? Most solutions consider this valid.
You are kind of on the right track, I'll explain it again because some people seem to still have problems undestanding the concept. A single pixel is never 4-connected by itself, but you can calculate whether or not two pixels are 4-connected. We say that the second assertion holds when they are connected vertically or horizontally (but not diagonally).
In other words:
Thus, a 4-connected component is a bunch of pixels where you can go from any pixel to any other by only "jumping" between 4-connected pixels.
I hope you understand now :)
The description does seem a bit confusing, but there's no need for wikipedia. I think the simplest way I could describe it is: a cluster of connected
*
s form 1 component (in such way, that if you pick any 2 of those*
, you could travel from 1 to the other one by following connected*
s, whether it's up,down,left or right).If it's just a sole pixel not connected to any other, it still counts as a component. Description shows 2 components: the larger one on the left, and one on the right (4 connected pixels). It may seem like there's more of them, but it's just that spacing between rows is bigger and it looks like there's black pixels in-between :/
Does that make it any clearer? =/
Now they are very good.