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
Picture auto enhancement #2906
Comments
Hello @lovell , thank you a lot for your answer! Do I'm doing something wrong ? const fs = require("fs");
const sharp = require("sharp");
let files = fs.readdirSync('./input');
console.log("Input files: ", files);
if (fs.existsSync('./output'))
fs.rmdirSync('./output', { recursive: true, force: true });
fs.mkdirSync('./output');
files.forEach(fileName => {
console.log('Convert: ./input/' + fileName + " -> ./output/" + fileName + " ...");
let image = sharp('./input/' + fileName);
image.metadata()
.then(metadata => {
image.clahe({ width: metadata.width, height: metadata.height })
.normalise()
.withMetadata()
.toFile('./output/' + fileName);
})
}); |
Perhaps try using CLAHE with a smaller local region. https://en.wikipedia.org/wiki/Adaptive_histogram_equalization For example using the following code with the above input: sharp(input)
.clahe({ width: 21, height: 21 })
.normalise()
... produces: |
Thank you @lovell, yes in fact with a smaller local region made it look better. Is there a way to make it automatically brighter or darker? |
The |
Then there is no way to detect it automatically? :/ |
Let's track this at #200, which is about improving |
I'm sorry if this question seems silly but I didn't see anywhere an "auto" mode other than for the rotation function.
What are you trying to achieve?
We have a lot of documents arriving in our system that are scanned and often not easily readable, we are looking to auto enhances (if necessary) the picture, the contrast, and the luminosity (like the filter of windows).
By "if necessary" I mean: that we don't want to apply a
luminosity + 10
on an image already too bright or a- 10
on one already too dark.Have you searched for similar questions?
Yes, but I didn't found.
Are you able to provide a minimal, standalone code sample that demonstrates this question?
An example:
Input:
Output:
Are you able to provide a sample image that helps explain the question?
(Yes see the two above)
The text was updated successfully, but these errors were encountered: