使用Leptonica API剪裁照片 - >或哪个图像处理Lib使用? [英] Crop pictures with Leptonica API -> OR which image processing Lib to use?
问题描述
我想做两件事 - >首先我需要读取一个图像并裁剪它(坐标/框架将由用户提供)。然后我想运行一个OCR。 (实际上,OCR的裁剪应严格分割)。
现在对我的问题:
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:
对于OCR我使用Tesseract,它使用Leptonica API进行图像处理。
因为我为嵌入式设备编程,我想保持不同库的计数低。所以我最好的兴趣是剪裁我的形象与Leptonica,所以我不需要第三个库,只是为了做这个任务。
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.
所以我的问题是,我怎么能剪切框架与Leptonica?有没有办法?
So my question is now, how can I cut out frames with Leptonica? Is there even a way?
推荐答案
在非官方文档中有一个例子,它似乎包含了裁剪: http://tpgit.github.com/Leptonica/croptext_8c_source.html
There's an example in the unofficial documentation which seems to incorporate the cropping: http://tpgit.github.com/Leptonica/croptext_8c_source.html
更具体地说,你应该创建一个框(即裁剪窗口),然后调用pixClipRectangle()函数裁剪图像:
To be more specific, you should create a box (ie. cropping window) and then call pixClipRectangle() function to crop the image:
BOX* cropWindow = boxCreate(x, y, w, h);
PIX* croppedImage = pixClipRectangle(image, cropWindow, NULL);
这篇关于使用Leptonica API剪裁照片 - >或哪个图像处理Lib使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!