RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / 问题

全部问题

Martin Hope
Step Xxl
Asked: 2024-10-25 14:19:04 +0000 UTC

尝试从 easyocr 图像读取文本时出错

  • 5

这是代码本身

import cv2
import numpy as np
import imutils
import easyocr
from matplotlib import pyplot as pl

img = cv2.imread('images/lixiang.jpg')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

img_filter = cv2.bilateralFilter(gray, 11, 90, 15)
edges = cv2.Canny(img_filter, 50, 200)

cont = cv2.findContours(edges.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)    
cont = imutils.grab_contours(cont)
cont = sorted(cont, key=cv2.contourArea, reverse=True)[:8]

pos = None
for c in cont:
    approx = cv2.approxPolyDP(c, 10, True)

    if len(approx) == 4:
        pos = approx
        break

mask = np.zeros(gray.shape, dtype='uint8')
new_img = cv2.drawContours(mask, [pos], 0, 255, -1)
bitwise_img = cv2.bitwise_and(img, img, mask = mask)

(y, x) = np.where(mask==255 )
(x1, y1) = (np.min(x), np.min(y))
(x2, y2) = (np.max(x), np.max(y))
crop = gray[x1:x2, y1:y2]

text = easyocr.Reader(['en'])
text = text.readtext(crop)

pl.imshow(cv2.cvtColor(crop, cv2.COLOR_BGR2RGB))
pl.show()

错误:

 CompleteTraceback (most recent call last):
  File "c:\Users\������������\OneDrive\������� ����\a\OpenCV\numbers_plates.py", line 34, in <module>
    text = easyocr.Reader(['en'])
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\������������\AppData\Local\Programs\Python\Python311\Lib\site-packages\easyocr\easyocr.py", line 92, in __init__
    detector_path = self.getDetectorPath(detect_network)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\������������\AppData\Local\Programs\Python\Python311\Lib\site-packages\easyocr\easyocr.py", line 253, in getDetectorPath
    download_and_unzip(self.detection_models[self.detect_network]['url'], self.detection_models[self.detect_network]['filename'], self.model_storage_directory, self.verbose)
  File "C:\Users\������������\AppData\Local\Programs\Python\Python311\Lib\site-packages\easyocr\utils.py", line 628, in download_and_unzip
    urlretrieve(url, zip_path, reporthook=reporthook)
  File "C:\Users\������������\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 277, in urlretrieve
    reporthook(blocknum, bs, size)
  File "C:\Users\������������\AppData\Local\Programs\Python\Python311\Lib\site-packages\easyocr\utils.py", line 728, in progress_hook
    print(f'\r{prefix} |{bar}| {percent}% {suffix}', end='')
  File "C:\Users\������������\AppData\Local\Programs\Python\Python311\Lib\encodings\cp1251.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'charmap' codec can't encode character '\u2588' in position 12: character maps to <undefined>
python
  • 1 个回答
  • 52 Views
Martin Hope
DDkube
Asked: 2024-10-25 01:32:41 +0000 UTC

导入带有条件的表

  • 5

有两个表,第一个表垂直显示在 A 列 - 姓氏中,第 1 行显示日期,在姓氏和日期的交叉处我们输入 1 - 8 之间的数字(我们可以将单元格留空)。 表1

需要填写表2的数据,条件是显示全名以及从和到期间的小时数(B栏)。

表2

这些表是在不同的文档中创建的,我尝试通过 importrage 来完成,但没有成功。

google-sheets-api
  • 1 个回答
  • 32 Views
Martin Hope
STANLEY
Asked: 2024-10-24 22:46:41 +0000 UTC

“常量创建的参数必须是常量表达式”(Dart)

  • 6

在此代码中:

class _MenuWidget extends StatelessWidget {
    const _MenuWidget({Key? key}) : super(key: key);

    @override
    Widget build(BuildContext context) {
        return Container(
            color: Colors.white,
            width: double.infinity,
            child: const Column(children: [
                _MenuWidgetRow(icon: Icons.computer),
                _MenuWidgetRow(icon: Icons.computer),
                _MenuWidgetRow(icon: Icons.computer),
                _MenuWidgetRow(icon: Icons.computer),
            ],)
        );
    }
}

class _MenuWidgetRow extends StatelessWidget {
    final IconData icon;

    const _MenuWidgetRow({super.key, required this.icon});
    
    @override
    Widget build(BuildContext context) {
        return const Padding(
            padding: EdgeInsets.symmetric(horizontal: 16, vertical: 10),
            child: Row(
                children: [
                    Icon(icon), // Ошибка тут
                    SizedBox(width: 15),
                    Expanded(child: Text('test')),
                    Icon(Icons.chevron_right),
                ],
            ),
        );
    }
}

出现错误:

Arguments of a constant creation must be constant expressions.
Try making the argument a valid constant, or use 'new' to call the 
constructor.dartconst_with_non_constant_argument

这和什么有关系呢?将绿色的推向解决方案:)

flutter
  • 1 个回答
  • 28 Views
Martin Hope
user642084
Asked: 2024-10-24 20:51:06 +0000 UTC

如何在架构上正确实现从数据库接收数据并将其传输到模型?

  • 7

我正在使用 MVVM 学习 WPF。

模型通常是 UI 所需的数据以及处理这些数据的一些方法。将创建一个单独的项目来访问数据。理论上,该级别不应该了解有关模型实体的任何信息。

有一个班级Teacher和TeacherGroup(老师担任的职位,例如物理学家和数学家)。

老师.cs:

public class Teacher
{
    public int Id { get; set; }
    public string FullName { get; set; }
    public List<TeacherGroup > Groups { get; set; }
}

TeacherGroup.cs:

public class TeacherGroup
{
    public int Id { get; set; }
    public string Name { get; set; }
}

这些是视图需要的模型实体。

如何正确地从数据库中获取这些数据并在架构上准确地将其传输到模型(填充实体)?创建一些 DTO 类或其他类。某种ObjectModel所有级别都可以访问的图书馆?

在 DAL 中,我计划创建一个类似于 的方法GetCurrentTeacher,该方法将从数据库接收有关当前教师及其所属组的数据。

如果可能的话,我想要一个带有例子的解释。

c#
  • 1 个回答
  • 89 Views
Martin Hope
Terra
Asked: 2024-10-24 20:38:18 +0000 UTC

如何更改列表中的特定元素而不在反应中创建单独的组件?

  • 5
import { useState } from "react"
import "./HiddenText.css"

const TextList = [
    {textStart: "Twenty-five hours had passed since the incident. It seemed to be a lot longer than that.", 
    textEnd: " That twenty-five hours seemed more like a week in her mind. The fact that she still was having trouble comprehending exactly what took place wasn't helping the matter. She thought if she could just get a little rest the entire incident might make a little more sense.",
    threeDots: "...",  
    key: 1},

    {textStart: "Another productive way to use this tool to begin a daily writing routine.", 
    textEnd: " One way is to generate a random paragraph with the intention to try to rewrite it while still keeping the original meaning. The purpose here is to just get the writing started so that when the writer goes onto their day's writing projects, words are already flowing from their fingers.",
    threeDots: "...",   
    key: 2},

    {textStart: "Another productive way to use this tool to begin a daily writing routine.", 
    textEnd: " One way is to generate a random paragraph with the intention to try to rewrite it while still keeping the original meaning. The purpose here is to just get the writing started so that when the writer goes onto their day's writing projects, words are already flowing from their fingers.",
    threeDots: "...",   
    key: 3},

    {textStart: "Another productive way to use this tool to begin a daily writing routine.", 
    textEnd: " One way is to generate a random paragraph with the intention to try to rewrite it while still keeping the original meaning. The purpose here is to just get the writing started so that when the writer goes onto their day's writing projects, words are already flowing from their fingers.",
    threeDots: "...",   
    key: 4},


]

export default function HiddenText() {
    const [toggleText, setToggleText] = useState(false)
    const [toggleThreeDots, setThreeDots] = useState(true)
    const [textBtn, setTextBtn] = useState("показать дополнительно")

    function openText() {
        setToggleText(toggleText => !toggleText)
        setThreeDots(toggleThreeDots => !toggleThreeDots)
        
        if (textBtn === "показать дополнительно") {
            setTextBtn("скрыть")
        } else {
            setTextBtn("показать дополнительно")
        }
    }
    
    return(
        <div className="HiddenTextContainer">
            {
                TextList.map(item => {
                    return(
                        <div className="elemCartText" key={item.key}>
                            <p>

                                {item.textStart}
 
                                {toggleThreeDots && <span>
                                    {item.threeDots}
                                </span>}

                                {toggleText && <span>
                                    {item.textEnd}
                                </span>}

                            </p>

                            <button onClick={openText}>
                                 {textBtn}
                            </button>
                        </div>

                    )
                })
            }
        </div>
    )
}
javascript
  • 1 个回答
  • 18 Views
上一页
下一页

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5