小编Dam*_*got的帖子

使用 Tesseract OCR 和 python 进行数字识别

我使用 Tesseract 和 python 读取数字(从能量计)。除了数字“1”外,一切正常。Tesseract 无法读取“1”数字。

这是我发送给 tesseract 的图片: 在此处输入图片说明

tesseract 读作“0000027”。

我如何告诉 Tesseract 垂直杆是“1”?

这是我的tesseract初始化:

import tesseract

TESSERACT_LIBRARY_PATH = "C:\\Program Files (x86)\\Tesseract-OCR"
LANGUAGE = "eng"
CHARACTERS = "0123456789"
FALSE = "0"
TRUE = "1"

def init_ocr():
    """ 
    .. py:function:: init_ocr()

        Utilize the Tesseract-OCR library to create an tesseract_ocr that 
        predicts the numbers to be read off of the meter. 

        :return: tesseract_ocr Tesseracts OCR API.
        :rtype: Class
    """
    # Initialize the tesseract_ocr with the english language package.
    tesseract_ocr = tesseract.TessBaseAPI()
    tesseract_ocr.Init(TESSERACT_LIBRARY_PATH, …
Run Code Online (Sandbox Code Playgroud)

python ocr tesseract

5
推荐指数
1
解决办法
7068
查看次数

Pandoc:如何在目录前添加表格?

我想在 pandoc/markdown 生成的目录之前添加一个表格。

\n\n

我找到了参数“include-before”。这样,我可以在目录之前添加文本。但是有没有办法添加表格呢?

\n\n

下面显示我的代码。我希望目录位于两个表和 header1 之间,而不是在表之前。

\n\n

还有另一种方法可以实现这一目标吗?我只想使用一个文件进行生成。

\n\n

感谢您的帮助

\n\n
---\ngeometry: margin=1in\nfontfamily: qbookman\nnumbersections: true\ntoc: true\ntoc-title: Table des mati\xc3\xa8res\nheader-includes: |\n    \\usepackage{graphicx}\n    \\usepackage{fancyhdr}\n    \\pagestyle{fancy}\n    \\setlength\\headheight{20pt}\n    \\lhead{\\includegraphics[width=4cm]{C:/logo.png}}\n    \\rhead{Doc generator}\n---\n\n+---------------+---------------------------------------------------------------+\n| **Title**     | Markdown - Pandoc - Plantuml \\                                \n|\n+---------------+---------------------------------------------------------------+\n| **Customer**  | Customer \\                                                      \n|\n+---------------+---------------------------------------------------------------+\n| **Project**   | Doc generator                                                 \n|\n+---------------+---------------------------------------------------------------+\n\n\n----------------------------------------------------------------------------------\n**VERSION**  **DATE**      **MODIFICATION**                            **AUTHOR**\n-----------  ------------- ------------------------------------------- -----------\n1.0          20-12-2018    Initial                                     DGO \n\n----------------------------------------------------------------------------------\n\n\n# Header 1\nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. \n …
Run Code Online (Sandbox Code Playgroud)

markdown tableofcontents pandoc

4
推荐指数
1
解决办法
3130
查看次数

One else for multiple if conditions

I created some functions which return 1 if all went well and 0 if there was an error. Now, I need to execute each of these functions in a defined order and verify the return values. If one of them returns 0, I need to reboot immediately, without invoking any of the subsequent functions.

I intended to use multiple ifs but with one else:

if function_1():
    if function_2():
        if function_3():
            print "Everything went well"
else:
    reboot()
Run Code Online (Sandbox Code Playgroud)

but it …

python if-statement short-circuiting

-1
推荐指数
1
解决办法
4000
查看次数