惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

量子位
云风的 BLOG
云风的 BLOG
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Hacker News
The Hacker News
Martin Fowler
Martin Fowler
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
U
Unit 42
F
Full Disclosure
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Recorded Future
Recorded Future
Security Archives - TechRepublic
Security Archives - TechRepublic
阮一峰的网络日志
阮一峰的网络日志
T
Threatpost
P
Privacy International News Feed
GbyAI
GbyAI
Stack Overflow Blog
Stack Overflow Blog
MongoDB | Blog
MongoDB | Blog
I
Intezer
Recent Announcements
Recent Announcements
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
P
Privacy & Cybersecurity Law Blog
A
Arctic Wolf
博客园 - 聂微东
博客园 - 叶小钗
Cisco Talos Blog
Cisco Talos Blog
H
Help Net Security
S
Schneier on Security
Y
Y Combinator Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
The Exploit Database - CXSecurity.com
T
Tor Project blog
月光博客
月光博客
NISL@THU
NISL@THU
A
About on SuperTechFans
Spread Privacy
Spread Privacy
Blog — PlanetScale
Blog — PlanetScale
D
DataBreaches.Net
雷峰网
雷峰网
C
CXSECURITY Database RSS Feed - CXSecurity.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 【当耐特】
G
Google Developers Blog
W
WeLiveSecurity
P
Palo Alto Networks Blog
The Last Watchdog
The Last Watchdog
K
Kaspersky official blog
博客园 - 司徒正美
L
LINUX DO - 热门话题
小众软件
小众软件

C#

asp net core 的工作站模式和服务器模式的区别 - V2EX C#上位机开发是用 winform 那种传统工业风还是 WPF 现代风 - V2EX paddleocr 的 C#集成问题 - V2EX C#中异步相关的问题 - V2EX .NET 换新的异步编程模型了,性能很强 - V2EX 想念 C# - V2EX 200 块有偿求助 C#高速读取串口,导致软件闪退的问题。 - V2EX 老师,我太想进步了——关于 C#学习 - V2EX visual studio 2022 代码提示消失 - V2EX Cursor 生成的代码有个大坑,排查了一晚上才找出原因 - V2EX C# 有哪些显著的缺点? - V2EX 有没有 Sematic Kernel 可以落地的应用推荐? - V2EX 请教下 C#有没有办法用装饰器全局监控方法执行时间 - V2EX 想用 c#的 mvc 实现一个功能. - V2EX Unity 双击 C#脚本默认打开 Visual Studio 没有代码提示如何解决? - V2EX 请问 c#有没有一些能规范学习的生产管理系统开源项目? - V2EX C#串口通信问题 求教 - V2EX C# 怎么同时交叉编译 windows Linux mac ?跟 go 一样 - V2EX ClosedXML 如何对一列数据设置高亮重复项?(高亮重复项是 Excel 的一种功能;不能手动给重复单元格设置背景颜色,这样的话用户删除重复项后不会自动去除高亮) - V2EX 求推荐软件开发练习项目的教学视频或书籍 - V2EX 如何在 visual studio 2022 中新建单元测试项目时默认使用最新版本? - V2EX C#有像 C++的 libevent 同样定位的高性能跨平台网络库吗? - V2EX 求助,如何正確劫持系統 DLL 調用 - V2EX C#生态里有啥简单一点的容易上手的开源后台管理系统吗? - V2EX .NET6 HttpClient 无反应也不超时? - V2EX 关于.NET6 httpclient 用 IPV6 还是 IPV4 的疑问 - V2EX 关于 C#调用 DLL 的疑惑 - V2EX C#程序员开发手机页面有什么适合的 UI 框架? - V2EX 求教大佬,用 C#如何操作 word 文档 - V2EX 如何配置环境变量才能让 dotnet 和 ipconfig 都可以工作? - V2EX 请教一个 sha256withecdsa 签名的问题 - V2EX C#中有什么专有名词来定义 方法.方法 这种调用方式么? - V2EX 请问是否有 C# “官方”文档? - V2EX 关于 c#软件的逆向分析 - V2EX c#程序里的一个字符串参数,可以在生成的 exe 文件里搜索到吗? - V2EX C#新建项目后新建的各种文件的作用是什么? - V2EX 请问这个访问控制声明是否有点多余? - V2EX 请教, c#语言中,一个回调函数中使用 lock 部分执行较慢的代码,后续执行回调函数中 lock 操作执行顺序是不是不能保证先执行顺序 - V2EX 既然已经继承了 BCL 中的 IComparable 接口,为什么还要自己写 CompareTo 方法的实现? - V2EX C#中类 类型的变量是通常所说的“对象么?”类的实例又是什么? - V2EX C#单元测试为什么不能过多使用 setup? - V2EX C# 类中的这个构造函数能不能省略? - V2EX 如何让 C# 窗体标签的语言默认是中文? - V2EX C# 中 this 关键字在 Forms 类中使用的困惑 - V2EX 2023 年了,值得入行 C#上位机吗? - V2EX 想学习辉芒微单片机开发,有大佬有学习资料和方式吗 - V2EX 使用 C#的 HPSocket 的一个问题 - V2EX C# 有没有 Rust 和 Lisp 那样, if/match 能直接求值,像三目运算符一样的功能? - V2EX 泛型存 List 的一个问题 - V2EX 有 C++基础入门 C#有推荐的书或课程吗,准备学习 unity 游戏开发
C#的二维码摆渡解码遇到点问题 - V2EX
zhoufan47 · 2023-11-26 · via C#

之前在网上找到个 python 写的二维码摆渡程序,识别率颇高,但是 python 的 UI 界面实在难画,自己对 python 也不是很熟悉。 最近用 C#重写了一份,可以实现一些特定功能,但是发现无论是 ZXing.net 还是 Zbar ,识别效率和成功率对比之前 python 用的 CV2 打开摄像头+pyzbar 识别二维码的组合差很多很多。 python 下我是采用固定 10ms 读取摄像头识别一次,单次 6 图,效率大约是 60/s 。 c#下我是采用绑定 timer 的形式,20ms 触发一次从摄像头获取 bitmap ,送进 decoder 解码,效率只有 1/S ,甚至经常识别不出。 各位大佬帮忙看看。 C#核心代码

 private void decodeCurrentFrame()
    {
        if (graphics == null)
        {
            return;
        }
        //复制图像
        this.graphics.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, new Size(width, height), CopyPixelOperation.SourceCopy);
        this.pictureBox1.Image = this.bitmapSrc;
        Stopwatch sw = new Stopwatch();
        sw.Start();
        Bitmap bitmap = (Bitmap)this.bitmapSrc.Clone();
        //解码图片
        Result[] results = reader.DecodeMultiple(bitmap);
        //读取识别出来的二维码
        if (results != null)
        {
            foreach (Result result in results)
            {
                {
                    Console.WriteLine("成功识别");
                    string content = result.ToString();
                    if (content.Length <= 20)
                    {
                        return;
                    }
                    string prefix = content.Substring(0, 16); //获取文件前缀
                    string currentIndex = prefix.Substring(0, 8); //获取当前切片索引编号
                    string total = prefix.Substring(8); //获取总索引数
                    if (content.Contains("|"))
                    {
                        int prefixIndex = content.LastIndexOf("|");
                        int qrCurrentIndex = content.IndexOf("|");
                        currentIndex = content.Substring(0, qrCurrentIndex);
                        string raw = content.Substring(prefixIndex + 1);
                        content = "0000000000000000" + raw;
                        Console.WriteLine("旧版数据" + raw + "索引编号:" + currentIndex);
                    }
                    initResultMap(total);
                    dealData(currentIndex, content.Substring(16));
                    checkResultMap();
                }
            }
        }
        //统计数据
        sw.Stop();
        TimeSpan ts = sw.Elapsed;
        string costed = ts.TotalMilliseconds + "ms";
        labelTickCost.Text = costed;
    }
    

pyhon 核心代码

   def decodeDisplay(img):
        global number
        barcodes = pyzbar.decode(img)
        for barcode in barcodes:
            barcodeData = barcode.data.decode()
            try:
                i = int(barcodeData[:8])
            except ValueError:
                return img
            try:
                max = int(barcodeData[8:16])
            except ValueError:
                return img
            ll = ''

            if not os.path.exists("temp/result" + str(i) + ".txt"):
                barcodeData = barcodeData[16:]
                with open("temp/result" + str(i) + ".txt", "w+") as f:
                    f.write(barcodeData)
                    number = number + 1
                    global sat
                if number == max:
                    filecount = len(os.listdir('temp/result'))
                    if number != filecount:
                        number = filecount
                        continue
                    j = 1
                    while j <= number:
                        with open("temp/result" + str(j) + ".txt", "r+") as f:
                            txt = f.read()
                        ll = ll + txt
                        j = j + 1
                    global starttime
                    ent = time.time()
                    theLB.insert(END, "识别结束")
                    theLB.see(END)
                    with open("result/b64.txt", "w") as f:
                        f.write(ll)
                    temp = base64.b64decode(ll)
                    with open("result/result.txt", "wb") as f:
                        f.write(temp)
                    if tkinter.messagebox.askyesno(title='识别成功', message='另存为'):
                        old_path = tk.filedialog.askdirectory()
                        shutil.copy("result/result.txt", old_path)
                    theLB.insert(END, "识别成功")
                    del_file()
        return img