Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DIP] rotate2d operation may change picture size. #158

Closed
taiqzheng opened this issue Jun 6, 2023 · 4 comments
Closed

[DIP] rotate2d operation may change picture size. #158

taiqzheng opened this issue Jun 6, 2023 · 4 comments
Labels
bug Something isn't working DIP

Comments

@taiqzheng
Copy link
Contributor

taiqzheng commented Jun 6, 2023

Describe the bug
Image size change after rotation.

  • input shape [1026, 1026]
  • output shape [1028, 1028]

To Reproduce
After compiling the image-processing-rotate-benchmark benchmark. (rotate2d PR)
RUN:
./image-processing-rotate-benchmark ../../benchmarks/ImageProcessing/Images/YuTu.png RADIAN 1.57

Expected behavior
An output image with [1026, 1026].

Additional context
For comparing the similarity of Buddy & OpenCV rotation image, we need their result image with the same size.

@meshtag
Copy link
Member

meshtag commented Jun 11, 2023

rotate_2d API is supposed to change the output image dimension by default. This is done for avoiding cutting off the edges in the rotated image. I think you can do some tricks to achieve the same effect with OpenCV's version as well.

As for this case of rotating the image with 90 degree, I agree that the output image must be of the same size as the input image (since num_rows = num_cols). Can you try giving a more accurate value of pi/2? (For ex. 1.570796)

@meshtag
Copy link
Member

meshtag commented Jun 11, 2023

I tried putting in the more accurate value of pi/2 and got the output image dimensions as 1027x1027. This is because of the extra 1 I added here for taking care of out of bounds accesses. But I think we can remove that now since we have access control in the valBound function.

@meshtag meshtag added bug Something isn't working DIP labels Jun 16, 2023
@meshtag
Copy link
Member

meshtag commented Jun 16, 2023

@taiqzheng, this commit should ideally fix this problem. Can you please confirm if this works for you.

@taiqzheng
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working DIP
Projects
None yet
Development

No branches or pull requests

2 participants