Skip to content

Conversation

@AHolliday
Copy link
Contributor

resolves #2102

This pullrequest changes

During one of the stages of selective search, the image is rotated 45 degrees and gradients are computed along the X and Y directions in the rotated image. The gradient image is then rotated back to the original orientation and cropped to remove surrounding empty space, leaving it with the same shape as the original image. However, the implementation of the crop will specify an ROI with negative x or y values if the image's native aspect ratio is too high or too low (basically, if the image is far from square).

This is because the bounding box of the rotated image is strictly bigger than the original image if the original is sufficiently close to square; but if the original is too "skinny", the bounding box of its rotation will be less tall or wide than the original.

The fix is to threshold the x and y computed for the ROI at 0.

Note: while fixing this bug, I also discovered that parts of "narrow" gradient images were being clipped at their edges due to improper cropping, again due to the apparent assumption that the bounding box of the rotated image was always strictly bigger in both axes than the original image. This PR includes a fix for that as well.

Another note: Something seemed to go wrong with the previous PR, so I've created this new one.

@opencv-pushbot opencv-pushbot merged commit 81b6165 into opencv:3.4 Jun 1, 2019
@alalek alalek mentioned this pull request Jun 5, 2019
@jmliu1983
Copy link

I have same issue. Is this problem fixed, please? Can I get updated form Anaconda, please? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants