Closed gradygabriel10 closed 3 years ago
Can you give me the image
Yes, I'm using docker container to run this but it keeps printing nothing. Can you help me with this?
I mean the test2.jpg
Oh. I tried these two and the results are the same.
package main
import (
"fmt"
"github.com/otiai10/gosseract"
)
func main() {
client := gosseract.NewClient()
defer client.Close()
client.SetImage("path/to/image.png")
text, err := client.Text()
fmt.Println(text, err)
}
Unfortunately, it doesn't work. The code shows this error:
failed to initialize TessBaseAPI with code -1: Error opening data file /usr/share/tesseract-ocr/4.00/tessdata/eng.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory. Failed loading language 'eng' Tesseract couldn't load any languages!
OK, then you can read and follow the error message.
Use gosseract/test:debian
image instead. It works in that image
root@30908b28382b:~/go# go run main.go
at his touch ofa certain icy pang along my blood. “Come, sir,’ said I.
“You forget that I have not yet the pleasure of your acquaintance. Be
seated, if you please.” And I showed him an example, and sat down
myself in my customary seat and with as fair an imitation of my or-
dinary manner to a patient, as the lateness of the hour, the nature of
my preoccupations, and the horror I had of my visitor, would suffer
me to muster.
“I beg your pardon, Dr. Lanyon,” he replied civilly enough. “What
you say is very well founded; and my impatience has shown its heels
to my politeness. I come here at the instance of your colleague, Dr.
Henry Jekyll, on a piece of business of some moment; and I under-
stood...” He paused and put his hand to his throat, and I could see,
in spite of his collected manner, that he was wrestling against the
approaches of the hysteria—“I understood, a drawer...”
But here I took pity on my visitor’s suspense, and some perhaps
on my own growing curiosity.
“There it is, sir,” said I, pointing to the drawer, where it lay on the
floor behind a table and still covered with the sheet.
He sprang to it, and then paused, and laid his hand upon his
heart: I could hear his teeth grate with the convulsive action of his
jaws; and his face was so ghastly to see that I grew alarmed both for
his life and reason.
“Compose yourself,’ said I.
He turned a dreadful smile to me, and as if with the decision of
despair, plucked away the sheet. At sight of the contents, he uttered
one loud sob of such immense relief that I sat petrified. And the
next moment, in a voice that was already fairly well under control,
“Have you a graduated glass?” he asked.
I rose from my place with something of an effort and gave him
what he asked.
He thanked me with a smiling nod, measured out a few min-
ims of the red tincture and added one of the powders. The mix-
ture, which was at first of a reddish hue, began, in proportion as the <nil>
root@30908b28382b:~/go#
Hi,
Can I see your main.go code, please?
On Thu, Jan 7, 2021 at 6:03 PM Hiromu OCHIAI notifications@github.com wrote:
Use gosseract/test:debian image instead. It works in that image
root@30908b28382b:~/go# go run main.go
at his touch ofa certain icy pang along my blood. “Come, sir,’ said I.
“You forget that I have not yet the pleasure of your acquaintance. Be
seated, if you please.” And I showed him an example, and sat down
myself in my customary seat and with as fair an imitation of my or-
dinary manner to a patient, as the lateness of the hour, the nature of
my preoccupations, and the horror I had of my visitor, would suffer
me to muster.
“I beg your pardon, Dr. Lanyon,” he replied civilly enough. “What
you say is very well founded; and my impatience has shown its heels
to my politeness. I come here at the instance of your colleague, Dr.
Henry Jekyll, on a piece of business of some moment; and I under-
stood...” He paused and put his hand to his throat, and I could see,
in spite of his collected manner, that he was wrestling against the
approaches of the hysteria—“I understood, a drawer...”
But here I took pity on my visitor’s suspense, and some perhaps
on my own growing curiosity.
“There it is, sir,” said I, pointing to the drawer, where it lay on the
floor behind a table and still covered with the sheet.
He sprang to it, and then paused, and laid his hand upon his
heart: I could hear his teeth grate with the convulsive action of his
jaws; and his face was so ghastly to see that I grew alarmed both for
his life and reason.
“Compose yourself,’ said I.
He turned a dreadful smile to me, and as if with the decision of
despair, plucked away the sheet. At sight of the contents, he uttered
one loud sob of such immense relief that I sat petrified. And the
next moment, in a voice that was already fairly well under control,
“Have you a graduated glass?” he asked.
I rose from my place with something of an effort and gave him
what he asked.
He thanked me with a smiling nod, measured out a few min-
ims of the red tincture and added one of the powders. The mix-
ture, which was at first of a reddish hue, began, in proportion as the
root@30908b28382b:~/go#
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/otiai10/gosseract/issues/211#issuecomment-756499164, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALTD6S5MFXG6DOV6R6BYCDDSYZRWFANCNFSM4VYOQ4EA .
% ls
main.go test-211.jpg
%
main.go
package main
import (
"fmt"
"github.com/otiai10/gosseract"
)
func main() {
client := gosseract.NewClient()
defer client.Close()
client.SetImage("./test-211.jpg")
text, err := client.Text()
fmt.Println(text, err)
}
% docker run -it --rm -v `pwd`:/root/go/workspace gosseract/test:debian bash
Inside docker container
root@360355b2b0d9:~/go/src/github.com/otiai10/gosseract# cd /root/go/workspace/
root@360355b2b0d9:~/go/workspace# ls -la
total 832
drwxr-xr-x 4 root root 128 Jan 8 03:12 .
drwxr-xr-x 1 root root 4096 Jan 8 03:28 ..
-rw-r--r-- 1 root root 223 Jan 8 03:12 main.go
-rw-r--r-- 1 root root 842378 Jan 8 01:56 test-211.jpg
root@360355b2b0d9:~/go/workspace#
root@360355b2b0d9:~/go/workspace# go run main.go
at his touch ofa certain icy pang along my blood. “Come, sir,’ said I.
“You forget that I have not yet the pleasure of your acquaintance. Be
seated, if you please.” And I showed him an example, and sat down
myself in my customary seat and with as fair an imitation of my or-
dinary manner to a patient, as the lateness of the hour, the nature of
my preoccupations, and the horror I had of my visitor, would suffer
me to muster.
“I beg your pardon, Dr. Lanyon,” he replied civilly enough. “What
you say is very well founded; and my impatience has shown its heels
to my politeness. I come here at the instance of your colleague, Dr.
Henry Jekyll, on a piece of business of some moment; and I under-
stood...” He paused and put his hand to his throat, and I could see,
in spite of his collected manner, that he was wrestling against the
approaches of the hysteria—“I understood, a drawer...”
But here I took pity on my visitor’s suspense, and some perhaps
on my own growing curiosity.
“There it is, sir,” said I, pointing to the drawer, where it lay on the
floor behind a table and still covered with the sheet.
He sprang to it, and then paused, and laid his hand upon his
heart: I could hear his teeth grate with the convulsive action of his
jaws; and his face was so ghastly to see that I grew alarmed both for
his life and reason.
“Compose yourself,’ said I.
He turned a dreadful smile to me, and as if with the decision of
despair, plucked away the sheet. At sight of the contents, he uttered
one loud sob of such immense relief that I sat petrified. And the
next moment, in a voice that was already fairly well under control,
“Have you a graduated glass?” he asked.
I rose from my place with something of an effort and gave him
what he asked.
He thanked me with a smiling nod, measured out a few min-
ims of the red tincture and added one of the powders. The mix-
ture, which was at first of a reddish hue, began, in proportion as the <nil>
root@360355b2b0d9:~/go/workspace#
package main
import ( "fmt" "github.com/otiai10/gosseract" )
func main() { client := gosseract.NewClient() defer client.Close() client.SetImage("path/to/image.png") text, _ := client.Text() fmt.Println(text) // Hello, World! }
I am using this code and run it in docker but still getting a blank without error