I have the following problem that I wanted to solve using opencv or scikit-image.
Suppose I have a "map" in the following form: 1 is ground 0 is water
map = np.array([
[ 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0.],
[ 0., 1., 1., 1., 0., 0.],
[ 0., 0., 1., 0., 1., 0.],
[ 0., 0., 0., 0., 1., 0.],
[ 0., 0., 0., 0., 0., 0.]])
- How many islands in the map? considering 4 neighbors. In this example there is 2
- Given an (i,j) position, return the number of ground neighbors. example: (2,2) -> 4
