小编Mar*_*rst的帖子

Tesseract OCR文字位置

我正在使用tesseract进行OCR。我能够使应用程序正常工作并获得输出。在这里,我试图从发票中提取数据并获取提取的数据。但是输入中单词之间的间距在输出文件中必须相似。我现在正在获取每个单词和坐标。我需要根据坐标导出到文本文件

代码示例:

            using (var engine = new TesseractEngine(Server.MapPath(@"~/tessdata"), "eng", EngineMode.Default))
            {
                engine.DefaultPageSegMode = PageSegMode.AutoOsd;
                // have to load Pix via a bitmap since Pix doesn't support loading a stream.

                using (var image = new System.Drawing.Bitmap(imageFile.PostedFile.InputStream))
                {

                    Bitmap bmp = Resize(image, 1920, 1080);

                    using (var pix = PixConverter.ToPix(image))
                    {
                        using (var page = engine.Process(pix))
                        {
                            using (var iter = page.GetIterator())
                            {
                                iter.Begin();
                                do
                                {
                                    Rect symbolBounds;
                                    string path = Server.MapPath("~/Output/data.txt");
                                    if (iter.TryGetBoundingBox(PageIteratorLevel.Word, out symbolBounds))
                                    {
                                        // do whatever you want with …
Run Code Online (Sandbox Code Playgroud)

c# asp.net ocr tesseract

6
推荐指数
1
解决办法
6778
查看次数

将迭代器存储在容器中

我正在构建另一个应用程序将使用的DLL.我想在从函数调用返回之前将一些数据的当前状态全局存储在DLL的内存中,这样我就可以在下次调用函数时重用state.

为此,我必须保存一些迭代器.我正在使用std :: stack存储所有其他数据,但我不确定是否可以使用迭代器来完成.

将列表迭代器放在容器类中是否安全?如果没有,你能建议一种方法来存储指向列表中元素的指针,以便我以后可以使用它吗?

我知道使用向量来存储我的数据而不是列表会允许我存储下标并非常容易地重用它,但不幸的是我只需要使用std :: list.

c++ iterator stl

4
推荐指数
2
解决办法
5774
查看次数

在 Python 3 中使用套接字获取 400 错误请求错误

我刚开始使用 Python 3.6.1 中的 Python Web 数据。我正在学习套接字,但我的代码有问题,我无法弄清楚。我的代码中的网站工作正常,但是当我运行此代码时,我收到 400 Bad Request 错误。我不太确定我的代码有什么问题。提前致谢。

import socket

mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

mysock.connect(('data.pr4e.org', 80))

mysock.send(('GET http://data.pr4e.org/romeo.txt HTTP/1.0 \n\n').encode())

while True:
    data = mysock.recv(512)
    if ( len(data) < 1 ):
        break
    print (data)

mysock.close()
Run Code Online (Sandbox Code Playgroud)

python sockets networking python-3.x web

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

std :: find不能使用std :: string

我有一个很奇怪的问题.我正在尝试使用 std::find宽度,std::string但在Visual Studio 2017中编译时出现以下错误:

Error C2446: '==': no conversion from 'const char *' to 'int'
c:\program files (x86)\microsoft visual studio\2017\enterprise\vc\tools\msvc\14.12.25827\include\xutility:3481
Run Code Online (Sandbox Code Playgroud)

产生问题的代码:

#include <algorithm>
#include <string>

int main(int argc, char **argv)
{
    std::string s("Just a test string");
    auto itr = std::find(s.begin(), s.end(), "t");
}
Run Code Online (Sandbox Code Playgroud)

替换"t"std::string("t")生成以下错误:

Error C2678: binary '==': no operator found which takes a left-hand operand of type 'char' (or there is no acceptable conversion) 
c:\program files (x86)\microsoft visual studio\2017\enterprise\vc\tools\msvc\14.12.25827\include\xutility:3481  
Run Code Online (Sandbox Code Playgroud)

c++ string find c++17

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

标签 统计

c++ ×2

asp.net ×1

c# ×1

c++17 ×1

find ×1

iterator ×1

networking ×1

ocr ×1

python ×1

python-3.x ×1

sockets ×1

stl ×1

string ×1

tesseract ×1

web ×1