robertknight / ocrs

Rust library and CLI tool for OCR (extracting text from images)
Apache License 2.0
1.09k stars 44 forks source link

does this work with opencv? #67

Closed Raj2032 closed 3 months ago

Raj2032 commented 3 months ago

can this work with opencv, the idea is that have a camera and in real time it can detect words by in real time covnerting words into text?

robertknight commented 3 months ago

I haven't tried using this with OpenCV, but in principle it should be possible. Inference speed will depend a lot on the hardware you run it on. On my 4-year old Intel laptop it takes about 1s end-to-end for a typical image. If using the Rust library you can run just the text detection, which will be quicker (~200ms) and then run recognition only if something is seen.

Raj2032 commented 3 months ago

On my 4-year old Intel laptop it takes about 1s end-to-end for a typical image

That's quite impressive :)

If using the Rust library you can run just the text detection step more quickly (~200ms) and then run recognition only if something is seen.

Sorry I didn't quite understand, are you saying don't run it as a software, but instead use it as a library and incorporate it into my opencv code? On Wednesday, May 8th, 2024 at 11:56 PM, Robert Knight @.***> wrote:

I haven't tried using this with OpenCV, but in principle it should be possible. Inference speed will depend a lot on the hardware you run it on. On my 4-year old Intel laptop it takes about 1s end-to-end for a typical image. If using the Rust library you can run just the text detection step more quickly (~200ms) and then run recognition only if something is seen.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

robertknight commented 3 months ago

Sorry I didn't quite understand, are you saying don't run it as a software, but instead use it as a library and incorporate it into my opencv code?

You can do either. The command-line tool has the advantage you can call it from any tool which can run a program. The library gives you more flexibility to eg. run only detection, or process a batch of images at once etc.

Raj2032 commented 3 months ago

@robertknight Hey mate, so what is meant by "run only detection"? What else does the program do?

robertknight commented 3 months ago

If you run the ocrs program normally on an image, the output is the text that was found. Internally it uses a three-step process where it first detects which pixels in the input are text, then attempts to determine how the text pixels should be grouped into words and lines, then attempts to read the text from each line. If you are using the library, you can run each of these steps independently. So if you only need to know whether an image contains text, but not what the text is, you can run just the first step.