1

I am looking to develop some code that will be able to by looking at images downloaded from google maps, categorize which part of the image depicts the land and which part depicts the sea.

I am a bit of a newbie to computer vision and machine learning so I am looking for a few pointers on specific techniques or API's that may be useful (I am not looking for the code to this solution).

What I have some up with so far:

  • Edge detection may not be much help (on its own). Although it gives quite a nice outline of the coast, artefacts on the surface/above the sea may give false positives for land mass (stuff like clouds, ships, etc).
  • Extracting the blue colour element of an image may give a very good indication of which is sea or not (as obviously, the sea has a much higher level of blue saturation than the land)

Any help is of course, greatly appreciated.

EDIT (for anyone who may want to do something similar):

WiseGuyEh
  • 18,584
  • 1
  • 20
  • 20
  • 1
    probably with a bit of experimentation you could find a good [threshold](http://en.wikipedia.org/wiki/Thresholding_%28image_processing%29) for google maps images. – Nick Dandoulakis Feb 03 '11 at 10:09

2 Answers2

2

I assume you are using the satellite view images from Google Maps otherwise you wouldn't have written about ships or other artefacts.

As you already said it might be a good idea to simply try to extract the blue image part. Just having a look at the blue channel of an RGB image isn't going to work (I just tried), since the woods and so on will not give a good threshold value on the water.

So you can try converting the image to YCbCr color space and have a look at the chrominance channels there.

This an example I just made with a screenshot from google maps. I converted it to YCbCr in Matlab and just took the Cb channel.

original screenshot

cb channel of ycbcr image

You can then binarize this image by a well set threshold, which shouldnt be too hard to find. You probably will still have small artefacts for which you could use morphological operators (Opening the image several times). This should remove small artefacts and leave the parts that are land and the parts that are water.

Hope it helps... if not, please keep asking...

EDIT

I've just tried again with another screenshot in matlab:

  1. Convert Image to YCbCr colorspace
  2. Just have a look at Cb channel
  3. find threshold on Cb image either fixed or by i.e. Otsu's method which finds an appropriate thresholdl in a bipartite histogram
  4. perform opening or other filters to eliminate small noises

The original image I made:

screenshot

After applying a threshold on the Cb image: after applying threshold

After applying an opening (5) on the image final image

I just picked a threshold manually... You might get better results by having a look which threshold would work better... But as you see this should also work on the different colors of water from rivers and ocean.

florianbaethge
  • 2,520
  • 3
  • 22
  • 29
  • Thankyou, this was very good advice. After a bit of digging on the google maps API, I was able to fetch map-like pictures from the static API with labels/road removed (does not remove existing ferry pathways but as they are blue, the techniques above generally remove them). These maps images do not suffer the artefacts described above and make thresholding alot easier. Example url- http://maps.google.com/maps/api/staticmap?sensor=false&size=1000x1000&center=dover&zoom=12&style=feature:all|element:labels|visibility:off&style=feature:road|element:all|visibility:off – WiseGuyEh Feb 03 '11 at 20:57
  • Ahh ok if those pictures work for you as well thats even better. I was just assuming you need the real satelite photos. Having those photos really makes thresholding easier since water should always have the same color (at least it looks so in your image). This results in much higher peaks in your histogram and makes thresholding easier. For those pictures you might even skip the part where you convert to YCbCr since water should always have one specific value in the blue channel of the RGB picture which should be fairly different than anything that is on land. – florianbaethge Feb 03 '11 at 22:04
1

You are looking for a segmentation algorithm, that assigns each pixel to one of two classes (land, sea). One of the simplest approaches is to use thresholding.

  1. define a threshold t
  2. if pixel value > t -> assign pixel to land
  3. else assign pixel to sea (usually you will have a bitmap, where you keep track of the pixel class)

Since this approach works best if you can distinguish land and sea masses easily, I would suggest that you compare the hue value of the pixels (i. e. find a threshold between blue and green).

bjoernz
  • 3,852
  • 18
  • 30