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

Support for Reinhard #24

Closed
andreped opened this issue Nov 23, 2022 · 2 comments
Closed

Support for Reinhard #24

andreped opened this issue Nov 23, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@andreped
Copy link
Collaborator

Reinhard color normalization is a commonly used method which is much faster than macenko and vahadane (see here). A drawback is that it is not as suitable for normalizing high-resolution patches, where the alternative methods are far superior.

However, for normalizing low-resolution images, reinhard might be more suitable. Hence, it would have been beneficial to have support for it.

It is also a very simple method to implement. I can make an attempt.

@andreped andreped added the enhancement New feature or request label Nov 23, 2022
@andreped andreped self-assigned this Nov 23, 2022
@andreped
Copy link
Collaborator Author

andreped commented Nov 23, 2022

I made a PR which adds reinhard support with numpy backend: #25

Regarding the other backends, it would be beneficial to use tensorflow-io, as it supports both rgb2lab and lab2rgb, which was annoying to implement from scratch in numpy:
https://www.tensorflow.org/io/api_docs/python/tfio/experimental/color/rgb_to_lab

In pytorch there exists a library that have the same color conversion methods:
https://github.com/richzhang/colorization-pytorch/blob/66a1cb2e5258f7c8f374f582acc8b1ef99c13c27/util/util.py#L172

We could either use these libraries directly, or make our own implementations, but this will take time, but I could make an attempt. Will make a separate PR for that, as it will likely be a lot of work.

The reinhard transform itself is quite straight forward to implement.

@andreped
Copy link
Collaborator Author

andreped commented Dec 4, 2022

New PR which adds torch backend support: #27

Now all backends should be supported after it has been merged. Hence, closing this issue.

@andreped andreped closed this as completed Dec 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

No branches or pull requests

1 participant