-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Does not get text from image if image contains some background objects #19
Comments
Im writing service in nodejs which will take image as a input and will use tesseract.js to process it and get the text out of it. There will not be any interaction in between. I will appreciate if you point me to some libs that will help me to do what you mentioned. |
I have not tried it myself, but https://github.com/oliver-moran/jimp seems to provide what you need. According to the examples: image
.greyscale()
.contrast(+1) Although you may also try to detect whether the image is rather dark or rather bright, and invert its colors accordingly. |
Thanks @mjurczyk that worked for me. |
@shamsher31 can u share how you implemented color inversion using jimp? |
@NikithShetty you can use the following code. It's just POC to understand how var Tesseract = require('tesseract.js');
var Jimp = require("jimp");
Jimp.read("img.jpg").then(function (image) {
image.greyscale()
.contrast(+1)
.normalize()
.write("img-opt.jpg");
})
.then(function() {
Tesseract.recognize('img-opt.jpg')
.progress(function(message){console.log(message)})
.catch(function(err){console.error(err)})
.then(function(result){console.log(result.text)})
})
.catch(function (err) {
console.error(err);
}); |
Thanks @shamsher-synerzip31 |
not getting text |
Why am I still getting notifications for this :') @monikacapternal @aditya0salaria - you probably have to desaturate the image and increase the contrast for readability. |
Im building mobile app for Motivation qoutes, where any one can add qoutes and send image link that contains qoutes in it. I used the following image.
it gives me text with proper line breaks, happy to see this.
"YOU LEARNED
TO LAUGH
BEFORE
YOU LEARNED
TO TALK."
But when I use this image
It gives me following text.
w?-
3 <5"
I! r
TEA WUERIGHT
1“ CE 0N5
*‘ A‘ £ I
Just want to ask if the lib only works with image without any background.
The text was updated successfully, but these errors were encountered: