I have a black and white image of the world map.
I convert pixels to a grid of binary values ββ(0 for water and 1 for earth), indexed by coordinates (i, j). Now say that I accidentally chose a point on land, and this time it's somewhere in Texas, USA. I want to know the coordinates (i, j) of all the points in which I move, without the need to touch the water. In this case, it will be any (i, j) in all of North and South America (excluding any surrounding islands).
(The motivation is that I am trying to simultaneously introduce a model of SIR infection in c.)
Many thanks for your help.
Edit: I would also be wondering if there are any approximate methods (I'm not too fussed if the tiny offshore islands were included by mistake.), Perhaps using a grid method, such as quadrants? Thanks again.
mchen source share