I have this map showing the geography of Europe (below), and I wish to convert it to a matrix in python that would be a 2D approximation of this image where 0's would represent the ocean and 1's would represent landmasses. I plan to subsequently to do a biased random-walk on the resulting grid where walkers are more likely to travel on land than water. Right now I just need help converting this image to 0's and 1's as mentioned, what would be the most straightforward way to do this in Python?
The resolution of the resulting matrix representation of 0's and 1's does not need to astoundingly high, although I would like to distinguish between high and low elevations (presumably I would need to account for higher elevations by maybe noting them as entries of 2's in the matrix representation).