sAnSiBaR Posted May 28, 2016 Report Share Posted May 28, 2016 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": 1 Quote Link to comment Share on other sites More sharing options...
hariasa Posted May 29, 2016 Report Share Posted May 29, 2016 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. Quote Link to comment Share on other sites More sharing options...
Arhanghelul Posted May 29, 2016 Report Share Posted May 29, 2016 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 ! Quote Link to comment Share on other sites More sharing options...
sAnSiBaR Posted May 29, 2016 Author Report Share Posted May 29, 2016 (edited) 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 May 29, 2016 by sAnSiBaR Quote Link to comment Share on other sites More sharing options...
rahmansunbeam Posted May 30, 2016 Report Share Posted May 30, 2016 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 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. Quote Link to comment Share on other sites More sharing options...
hariasa Posted May 31, 2016 Report Share Posted May 31, 2016 (edited) 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 May 31, 2016 by hariasa Quote Link to comment Share on other sites More sharing options...
yousef2233 Posted June 1, 2016 Report Share Posted June 1, 2016 If size matters and the shape is not complex, give this a try: Maximizing(proportion of polygon(i).boundary(part).length which falls within a close buffer around base.polygon.boundary to polygon(i).boundary(full).length) Quote Link to comment Share on other sites More sharing options...
sAnSiBaR Posted June 1, 2016 Author Report Share Posted June 1, 2016 @rahmansunbeamthe 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?@hariasaalso sounds like a good piece of software but as you say nowhere available, hope the authors will send me an attachment.@yousef2233I guess your proposal is to be interpreted like pseudo code? Quote Link to comment Share on other sites More sharing options...
rahmansunbeam Posted June 2, 2016 Report Share Posted June 2, 2016 @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. Quote Link to comment Share on other sites More sharing options...
dochtor Posted June 27, 2016 Report Share Posted June 27, 2016 (edited) 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 June 27, 2016 by dochtor Quote Link to comment Share on other sites More sharing options...
amelia54 Posted June 21 Report Share Posted June 21 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.