how to deal with large polygons ?
2 views (last 30 days)
hello everyone, I'm using geoimread() to read the image with the x and y coordinates of each polygon. and then I extract the x and y coordinates of each polygon and use inpolygon() to intersect the coordinates of the image and the polygon but if the polygon was large the inpolygon() doesn't give a result (the program is is busy for a long time)
is there a function faster than inpolygon()? or is there a way to divide the polygon to small polygons and process each one alone? the code is working when I intersect small polygons with the image only. in the attachment you can find a screen shot of the shape and the stalliate image
here is my code for more info:
shape = shaperead(fullfile('KTAF_sat_shapefiles','shapefiles','SAU1.shp'));
rx = shape(i).X(1:end-1);
ry = shape(i).Y(1:end-1);
[X,Y] = meshgrid(x,y);
Anton Semechko on 1 Jul 2018
Check out 'DecimatePoly' function on FEX: https://www.mathworks.com/matlabcentral/fileexchange/34639-decimate-polygon
Included in the above submission is 'DecimatePoly_demo3' function, which demonstrates how 'DecimatePoly' can be used to improve run-time of in-polygon tests at the cost of minor misclassification errors.