问题标签 [leptonica]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
python - Leptonica - 应用 otsu 阈值后无法写入图像
我正在尝试使用 leptonica 处理后将图像保存为 jpeg。我正在使用带有 ctypes 的 python,我的代码是:
此代码产生错误:
pixWriteJpeg 中的错误:pix 未定义
我相信这是因为我需要在应用 otsu 之后但在编写新图像之前做一些事情。我错过了什么?
编辑-
我现在根据 leptonica 文档http://tpgit.github.io/Leptonica/binarize_8c.html修改了以下内容:
现在出现一个新错误:
支持的最大图像尺寸为 65500 像素 pixWriteStreamJpeg 中的错误:内部 jpeg 错误 pixWriteJpeg 中的错误:pix 未写入流
我的图像分辨率为 1552 x 2592 并且 leptonica.pixWriteJpeg 在 otsu 函数行被注释掉时工作,所以看起来问题仍然在于 otsu 函数返回的图像。
**** 编辑 2 ****
当我使用 leptonica 检查输出 img 时,它告诉我宽度是一个很大的数字,每次运行该函数时似乎都会发生变化(例如 149996048),并且高度在与输入图像相同的值下保持正确。看起来 otsu 函数出于某种原因将图像宽度更改为这个大值。
编辑 3
下面的 jsbueno 为我提供了这个问题的解决方案,我将在这里分享。问题是因为我将图像直接传递给函数,而实际上需要将指针的指针传递给该函数然后才能工作。最终工作代码如下:
java - How to limit the results of recognition?
how to restrict the results of tess-two (Tesseract and Leptonica library),
I want Tesseract limiting the results:
- Only take 8 digits, calculated from letter D
- Don't take LowerCase, Enter, Space, and Symbol
- Only Take Uppercase and Numbers.
For Example:
The recognition result is "asn*&bhDK 1234 UDaks&%^jdg", then simply take is "DK1234UD".
so, don't take LowerChase, Enter, Space. Only take UperChase and numbers.
I use Java source code
this is the recognition code:
Can somebody tell me how can i do that? What should be added in here?
c - 尝试在 Go 中使用 C 包装器?
我一定遗漏了一些东西,但我正在尝试使用为此目的制作的 C 包装器在 Go 中使用 Leptonica C 库:
https://github.com/GeertJohan/go.leptonica/blob/master/leptonica.go
但我不明白......它允许我导入文件但是我如何实际调用 Leptonica 函数?(具体来说,我想使用 Leptonica 检测图像的偏斜。)
我在 Go 包装器中看不到任何允许我发送这样的命令的函数。我怎么跟它说话?
python - Tesseract training techniques for simple lists
so I'm training for the adaptive classifier (the default engine in Tesseract). But I'm having a bit of trouble with this a documentation is very fragmented and/or missing.
I'm training for a very small data set to start with, I thought I just start out using arial black until i gather more data on my subject. I would like to recognize labels on say cosmetics (in danish), which is just a list (comma separated words). And only very specific words, in particular:
smør, ost, yoghurt, ymer, ylette, fløde, milkshake, laktose, mælkesukker, animalsk fedtstof, animalsk olie, smørolie, bagermargarine, margarine, minarine, risbagemel, inddampet mælk, mælkebestanddele, mælketørstof, tørmælk, mælkepulver, skummetmælkspulver, sødmælkspulver, mælkeprotein, lactalbumin, kasein, kaseinat, calciumkaseinat, kaliumkaseinat, natriumkaseinat, valle, valleprotein, vallepulver, mælk,
And the same words starting with a capital letter (example: "Vallepulver"). But I keep having trouble figuring out a proper config file for this type of morphology, I though that I should probably utilize the DAWG system as accuracy and speed is very important.
So far I took the following steps: Used jTessboxeditor to generate a .box file convert the .box file to a .tr file with tesseract imagefile filename.exp0,box nobatch box.train Then extract the unicharset with unicharset_extractor filename.exp0.box Create a font property file, with following content: arial 1 0 0 0 0 Then cluster the character features with "mftraining" "cntraining" Renaming all the files to my choosen language name Creating a wordlist containing the above list Converting the wordlist to a lang.words.dawg with wordlist2dawg And finally combining the data with combine_tessdata lang. But I'm still expericening very inaccurate results (I'm using scantailor to preprocess the images before feeding them to Tesseract), here's the image (in .tif format) that I'm currently testing tesseract on:
https://drive.google.com/file/d/0B8e0HDFGiNZOOXpWbUQwc0l3N2xqYlE3SGN4d1BPcHlxQVRn/view?usp=sharing
The system is only supposed to recognize words from the above list (the only match between the list and the image would therefore be "milk").
Any suggestions to what I could be doing wrong/improve (especially in my nonexistent config) would be very apreciated as I have been struggling with this for quite a while now.
Sincerely a desperate fellow nerd.
android - Android Studio 项目中缺少 allheaders.h
我正在按照这个 tesseract 教程中的教程进行操作,并且在我实际运行 Java 代码之前,一切都很顺利。当我尝试
它抛出以下错误
我已经查看/jni/com_googlecode_leptonica_android/src/src
并在那里找到了allheaders.h
文件。我有一种感觉,我的路径是错误的,但我几乎尝试了一切,但无济于事。有什么问题?
windows - 将 Tesseract OCR 集成到 Visual Studio 2013
这里有一个问题相同的问题。但解决方案不存在。我用的是windows8,visual studio 2013。我的机器是64位的。我尝试将 tesseract ocr 集成到 vs2013。我从这里安装 leptonica 并从这里安装tesseract 。
我做了以下步骤:
项目解决方案 -> C++ -> 通用
/li>链接器-> 常规-> 附加库目录
C:\Tesseract-OCR\lib
链接器->输入->附加依赖项
libtesseract302.lib liblept168.lib
重启vs2013
我在主函数`tesseract::TessBaseAPI api;'中尝试以下行。当我运行这些代码时,我得到一个错误。
错误信息 :
rotation - 旋转时 Leptonica 裁剪图像
当我在图像上执行上述代码时,生成的图像的边缘被切断。
示例:原始扫描,然后是通过上述函数运行后的图像将其旋转约 89 度。
我还没有 10 声望,所以我不能嵌入图片,但这里有两张图片的链接:http: //imgur.com/a/y7wAn
我也需要它适用于任意角度(不仅仅是接近 90 度的角度),所以不幸的是,这里提出的解决方案不起作用。
pixRotate 函数的描述说:
然而,它似乎在旋转后扩展了目的地,因此即使最终图像尺寸正确,像素也会丢失。如果我使用 pixRotate(..., 0, 0) 而不是 pixRotate(..., w, h),我最终会得到在原始尺寸内旋转的图像:http: //i.imgur.com/YZSETl5。 .jpg _
我是否错误地解释了 pixRotate 函数描述?我想做的甚至可能吗?或者这可能是一个错误?
提前致谢。
java - Android (ART) 崩溃并出现错误 JNI DETECTED ERROR IN APPLICATION:jarray 是无效的堆栈间接引用表或无效引用
我正在编写一个处理来自本机 C (NDK r10d) 的图片的 Android 应用程序。该代码运行良好,直到最近引入对 JNI 更加严格的 ART。所以代码在 Dalvik 上运行良好(例如在前 Lolipop 设备上),但 ii 在最新的手机上创建了一个 SIGENV。
我现在得到错误:
我在 Java 中运行的代码是:
对应的本机代码为:
似乎 GetByteArrayElements 是错误的来源,但 JNIEnv 参考和 jbyteArray 是由 Android 提供的,我不存储也不修改它们。由于缓冲区数组总是分配在同一个 Java 线程中,我看不出它是如何被破坏的……我很困惑 :)
这个问题的根源是什么?
堆是不是太小了?或者它是一个艺术问题(虽然我真的很怀疑......)?
谢谢你的帮助!
c++ - An invalid parameter error at msvcr120.dll (Building Tesseract Lib in 64bit Windows)
I have already raised the inquiry to Tesseract Forum, but whether I can have a clue for the error, I raise the issue at this forum again. As this is my favorite forum in solving the problems.
I have a problem somehow related to the tesseract lib.
The problem is at libtiff one of the components used in leptonica library.
I followed exactly what is described here
in building libtiff for my 64bit windows.
Build is ok. Using tiff lib and I built leptonica lib and tessearact lib for 64bit windows. Once I run my application using tesseract lib, I got error at tiff lib and the error is
"Unhandled exception at 0x00007FFA966FDD27 (msvcr120.dll) in TessarActOCR_test.exe: An invalid parameter was passed to a function that considers invalid parameters fatal."
The error is happening at lseek in the following function. The function is located in tiffio.c
What could be wrong with this error?