Jump to content

How to classify polygons by shape?


Recommended Posts

Hi,

 

how do I classify polygons by shape or geometry? So that similar shapes are automatically recognized and classified.

I thought about using landscape metrics, but I dont want to convert to raster.

Available software: ArcInfo and QGIS.

 

Here is an illustration of the "process":

polygons.png

  • Like 1
Link to comment
Share on other sites

I know that with eCognition you can do such a thing from a raster (raster shapes, make polygons, classify polygons based on many different attributes), you probably could do it with a shapefile too, not sure though. A free alternative of eCognition is Orfeo, but I do not know if you can use that to do what you want.

Link to comment
Share on other sites

This is an interesting topic.

I have also asked myself how to integrate landscape metrics into eCognition to classify different building shapes in urban areas from high-resolution images and to estimate the degree of urban landscape fragmentation.

 

If someone has a solution to this problem, please share !

 

:blink:

Link to comment
Share on other sites

Thanks for reply !

 

Didn't know about Orfeo. I have experimented a little bit with its feature "Connected Component Segmentation", but no usable results so far. I guess eCognition is for raster analysis only?

 

Since my data is available in shape format I hope to cope without making a detour via raster conversion.

 

One simple method to figure out whether shape differs from an ideal circle is to use the Shape-Index (by Forman and Godron 1986). It indicates the relation between area and perimeter and is standardized in terms of size of area (only for theory, doesn't help at the moment):

 

SHAPE = p / (2*sqrt(pi*a)),

where p = perimeter and a = area; SHAPE >= 1, increasing values are less "compact" (this formula is related to vector data, raster formula differs from it, also see hxxp://www.umass.edu/landeco/research/fragstats/documents/Metrics/Shape%20Metrics/Metrics/P8%20-%20SHAPE.htm).

 

Another idea could be to split polygons into lines and analyze length of parallel lines or the amount of angles inside a polygon, but I don't know how.

Edited by sAnSiBaR
Link to comment
Share on other sites

If open source is all you have, try Python. OpenCV has some straightforward functionality for simpler solutions. Template matching can also be your solution if you know which shape is exactly going to appear. Using Hough Transformation algorithm of OpenCV you can extract linear feature. These are also a Circle Hough Transform algorithm to identify circular objects. 

import cv2
import numpy as np

img = cv2.imread('opencv_logo.png',0)
img = cv2.medianBlur(img,5)
cimg = cv2.cvtColor(img,cv2.COLOR_GRAY2BGR)

circles = cv2.HoughCircles(img,cv2.HOUGH_GRADIENT,1,20,
                            param1=50,param2=30,minRadius=0,maxRadius=0)

circles = np.uint16(np.around(circles))
for i in circles[0,:]:
    # draw the outer circle
    cv2.circle(cimg,(i[0],i[1]),i[2],(0,255,0),2)
    # draw the center of the circle
    cv2.circle(cimg,(i[0],i[1]),2,(0,0,255),3)

cv2.imshow('detected circles',cimg)
cv2.waitKey(0)
cv2.destroyAllWindows()

Result

houghcircles2.jpg

 

This paper discusses the same algorithm for rectangles. There are of course other options. Try R if you can. These are possible if you have a properly aligned shape inside a raster with minimum noise. But if it's a satellite image you don't have this freedom. eCognition has quite a lot of tool for shape recognition and classification. The latest version claims to have a template matching tool to make this work easier. MATLAB also has a lot of tool for object identification. 

Link to comment
Share on other sites

The TWOPAC software by DLR can also classify shapes (both pixel classification in raster and shape classification in a shapefile). It is a QGIS extension, though it is a bit hard to find where to download. There are some publications about this software, and maybe you can ask the authors if they have a link to download, since it is open source software.

hXXps://www.researchgate.net/publication/225020547_TWOPAC_-_A_new_approach_for_automated_classification_of_satellite_imagery
Edited by hariasa
Link to comment
Share on other sites

@rahmansunbeam
the worklfow/code of OpenCV seems to be clear, I have to try wheather I get complex shape/geometry into code.
However I could get eCogntion to run on my machine. Do you think it would be easier using it rather than the open source examples mentioned here?

@hariasa
also sounds like a good piece of software but as you say nowhere available, hope the authors will send me an attachment.

@yousef2233
I guess your proposal is to be interpreted like pseudo code?

Link to comment
Share on other sites

@rahmansunbeam

the worklfow/code of OpenCV seems to be clear, I have to try wheather I get complex shape/geometry into code.

However I could get eCogntion to run on my machine. Do you think it would be easier using it rather than the open source examples mentioned here?

If you have access to eCognition, why not. 

Link to comment
Share on other sites

  • 4 weeks later...

Hi all,

the topic interested me and I'd like to offer a way for determining the geometry shapes.

 

- the number of points,

- the number of edges,

- the std dev of edge lengths 

- the angles of points,

- the area of polygon,

- the center point location(inside the geom or outside the geom.)

...

 

such information may help to determine the shape difference of geometries. I will give it a try. :)

Edited by dochtor
Link to comment
Share on other sites

  • 7 years later...

When tackling the classification of polygons by shape, seeking homework help from services like MyAssignmentHelp proves invaluable. They offer structured guidance on identifying polygon types based on sides and angles, ensuring clarity and accuracy in assignments. This assistance not only enhances understanding but also fosters confidence in handling geometric concepts effectively, benefiting students aiming for academic excellence.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.

Disable-Adblock.png

 

If you enjoy our contents, support us by Disable ads Blocker or add GIS-area to your ads blocker whitelist