Hi, this is actually meant to be for a function called roipoly in matlab but it can be considered a general case problem.
Roipoly is a function which lets u select a polygon over an image, and returns a binary mask where u can use it to get indices of the desired polygon. (It is just a normal polygon after all).
My application (K-Nearest Neighbor) requires that i make n*n blocks out of the data i have (the polygon), i.e. If i have a polygon (a road or a piece of land), i want a n*n square moving over it while avoiding intersection with edges and putting those n*n pixels into some variable.
This problem would be a lot easier if i had all my shapes in the form of rectangles, but that unfortunately isn't the case. I might have something going diagonal, circular or just irregular.
Is there a known algorithm i can implement? or something that already does this or can make it easier in matlab?
I'm already working on it but its quite tricky, i want to make sure I'm not wasting time reinventing a wheel somewhere.
Any ideas?