I'm trying to do two things -> First I need to read in an image and crop it ( coordinates / frame will be provided by the user ). Then I want to run an OCR over it. ( Actually the cropping an the OCR shall be strictly divided ). Now to my problem:
For the OCR I'm using Tesseract, which is using the Leptonica API for the image processing. Since I'm programing for an embedded device I want to keep the count of different libraries low. So my best interest is to crop my image with Leptonica, so I don't need a third library just to do this task.
So my question is now, how can I cut out frames with Leptonica? Is there even a way?
There's an example in the unofficial documentation which seems to incorporate the cropping: http://tpgit.github.com/Leptonica/croptext_8c_source.html
To be more specific, you should create a box (ie. cropping window) and then call pixClipRectangle() function to crop the image:
stativ's answer works, but you must delete created objects:
and for PIX* there's