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

Improve normalise option with use of histogram #200

Closed
lovell opened this issue Apr 21, 2015 · 2 comments
Closed

Improve normalise option with use of histogram #200

lovell opened this issue Apr 21, 2015 · 2 comments

Comments

@lovell
Copy link
Owner

lovell commented Apr 21, 2015

As suggested by @jcupitt in #19.

You could also consider taking a histogram of L* and setting the range to 1% and 99%, ie. letting the top 1% and the bottom 1% over- and under-expose. This would make it less sensitive to noise and probably produce a more pleasing image in more cases.

vips_percent() does almost this, you'd swap your vips_stats() for this code:
https://github.com/jcupitt/libvips/blob/master/libvips/histogram/percent.c#L82

Python-based example:

low = image.percent(1)
high = image.percent(99)
image = (image - low) * (255 / (high - low))
@lovell
Copy link
Owner Author

lovell commented Apr 21, 2015

/cc @bkw

@lovell
Copy link
Owner Author

lovell commented Sep 5, 2022

Improved via commit 55c4d88 available in v0.31.0.

@lovell lovell closed this as completed Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant