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

Don't over-resize for masked images #157

Closed
zalgo3 opened this issue Aug 17, 2022 · 1 comment · Fixed by #211
Closed

Don't over-resize for masked images #157

zalgo3 opened this issue Aug 17, 2022 · 1 comment · Fixed by #211
Labels
Included in next release optimization Optimization of existing features

Comments

@zalgo3
Copy link
Contributor

zalgo3 commented Aug 17, 2022

Especially in the case of 1080p or higher, if the non-transparent area of the mask image used for the split is small, resizing the entire image to 320x240 will lose the information inside the mask. One idea to prevent this is to adaptively determine the target size according to the number of nonzero elements in the alpha channel of the split image. At least for the L2 norm and histogram, such a change would not affect performance since they only use information about the mask's interior.

@Avasam
Copy link
Collaborator

Avasam commented Sep 5, 2022

To reflect a comment I made on Avasam#45

This is a great idea, and I like your implementation in that pull request. Further improvement would be to crop the image and retarget the region if the mask allows, to reduce how much we need to shrink it. Might be a bit more complex and can be done later, I'm just mentioning it for posterity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Included in next release optimization Optimization of existing features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants