2

Here I got a binary image of buildings (black and white image) and I need to convert them to building polygons: enter image description here

The expected outcome will be a vector file with building polygons based on the image like this: blue as polygon edge and red as polygon area

enter image description here

However, I tried Raster -> Conversion -> Polygonize and Extraction -> Contour. The polygon created is not what I need:

enter image description here

Are there anyways to achieve the expected outcome?

3
  • 2
    If you zoom in on one of the building polygons, is the building boundary made up of lots of tiny squares? Because that problem can be solved by reclassifying your raster. In your case, convert all the gray cells to one single value, and convert all the white cells to a different value.
    – csk
    Jun 27, 2019 at 21:43
  • Hi @csk, I guess you are talking about r.reclass? Actually my original image is in black and white (I set alpha value for comparing the coordinates with other maps), does that still need a reclassifying process?
    – Pete
    Jun 28, 2019 at 4:14
  • Look at the raster histogram (in the layer properties) to find out if you need to reclassify your raster. You should only have two different values. All the "white" cells should be one value, and all the "black" cells should be a different single value. Eg, if you have a three-band raster in the range 0-255, all the cells should have the value 0 or 255. If the cells have values like (0, 1, 2, 253, 254, 255) then you need to reclassify the raster so they all have 0 or 255.
    – csk
    Jul 1, 2019 at 17:36

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.