EasyIDP
EasyIDP copied to clipboard
Crop the ROI along image boundarys
The current algorithm just moves points outside the image boundary along giving direction, but expect to crop by image boundary.

Suppose the size of the image is 1600900, and the coordinates of a vertex in the ROI are (1200, 1000). The existing method seems to change the vertex coordinates to (1200, 900) directly. It might be possible to pad the bottom of the original image to make it 16001000, crop the ROI, and then crop out the padded part. But this may add a lot of computation
Suppose the size of the image is 1600_900, and the coordinates of a vertex in the ROI are (1200, 1000). The existing method seems to change the vertex coordinates to (1200, 900) directly. It might be possible to pad the bottom of the original image to make it 1600_1000, crop the ROI, and then crop out the padded part. But this may add a lot of computation
Plan to implement this function by the shapely API, which is implemented by C and should be very fast (And it is just an option need user manually specify to activate, by default close).
Padding original images also need disk I/O cost for images, and one image may be duplicated stored for different ROIs.
Consider adding an option for user, just save the outside polygon coordinates as it. (Keep those polygons which touch the image boundary, rather than cropping [expected] or adjusting [current] )