Git Product home page Git Product logo

zhang-can / easypr-dll-csharp Goto Github PK

View Code? Open in Web Editor NEW
233.0 18.0 87.0 74.98 MB

EasyPR 1.5 的DLL版本——通过C#调用DLL文件来实现界面展现。(The DLL version of EasyPR 1.5: Achieving interface display by using the C # language to call DLL file. )

License: Apache License 2.0

C++ 91.72% C 0.19% C# 8.08%
chinese-plate-recognition visual-interface unconstrained-situation computer-vision machine-learning

easypr-dll-csharp's Issues

使用Create.Dll时出现了参数传入错误

Hello,我最近按照您的项目,尝试自己做了一遍,可是发现没有达到和您一样预期的效果。我尝试的代码如下:
`DllInvoke dll = new DllInvoke(@"CreateDLL.dll");
get_license_str_func get_license = (get_license_str_func)dll.Inovke("get_license_str",typeof(get_license_str_func));
do_lps_func lps = (do_lps_func)dll.Inovke("do_lps",typeof(do_lps_func));

//省略部分代码:打开文件,将文件名读取至FileName变量中

var result_num = lps(FileName,2);`

结果在运行的时候出现未响应情况,经过断点分析,发现在WinForm中文件名和参数正常,但是进入dll的do_lps函数时,文件名变为null,另一值变为0。但是对您的程序进行断点分析,其直接获得了最终结果,并不显示在dll中的运行情况

我初步怀疑是自己在进行dll引用出现了问题,想请教一下您,您当时引用dll库的时候使用了哪几个步骤呢,我也好参考一下。十分感谢!

程序运行出错:“System.ArgumentNullException”类型的未经处理的异常在 mscorlib.dll 中发生 其他信息: 值不能为 null。

//将要执行的函数转换为委托
public Delegate Invoke (string APIName,Type t)
{
IntPtr api = GetProcAddress(hLib, APIName);
return (Delegate)Marshal.GetDelegateForFunctionPointer(api, t);
}
错误定位在return 这一行,
显示:System.ArgumentNullException”类型的未经处理的异常在 mscorlib.dll 中发生 其他信息: 值不能为 null。

关于“尝试读取或写入受保护的内存”。原因: 链接器-输入-附加依赖项

首先感谢作者提供的代码,非常棒!(๑•̀ㅂ•́)و✧
运行时,也遇到了大家所说的“尝试读取或写入受保护的内存”。
找了好久找到原因。
作者:
链接器-输入-附加依赖项 : opencv_world310d.lib;%(AdditionalDependencies)
但其实要分情况
解决方案配置: debug模式下加opencv_world310d.lib,release模式下加opencv_world310.lib 是不同哒。

训綀问题

谢谢大神提供程式 其它操作都没问题
只有底下训綀都没反应 都无法生成xml档与ann_result.txt,svm_result.txt
ann create/ann train/svm create/svm train
我发现train底下只有ann资料匣没有看到svm资料匣
我反覆怎么试都不行 可以麻烦牛哥 github重新下载程式 再试看看吗 谢谢

关于编译的问题,报错“无效的数值参数”

您好,我的环境是WIN10 + VS2013 + opencv310, 请问我在编译的时候出现报错:"错误 28 error D8021: 无效的数值参数“/wd4267,4819” D:\EasyPR-DLL-CSharp-master\CreateDLL\cl CreateDLL",这个问题怎么解决呢?

使用vs2015编译出错

严重性 代码 说明 项目 文件 行 禁止显示状态
错误 D8021 无效的数值参数“/wd4267,4819” CreateDLL D:\opencv3.1.0\EasyPR-DLL-CSharp-master\CreateDLL\cl 1

编译完成后DEMO无法调用DLL

环境:win10、vs2017、opencv3.1.0、win10sdk
根据说明重新设置了c++工程
编译输出:
1>------ 已启动全部重新生成: 项目: LibLPS, 配置: Release x64 ------
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(387,5): warning MSB8028: 中间目录(x64\Release)包含从另一个项目(Core.vcxproj, libeasypr.vcxproj)共享的文件。 这会导致错误的清除和重新生成行为。
1>chars_identify.cpp
1>chars_recognise.cpp
1>chars_segment.cpp
1>core_func.cpp
1>feature.cpp
1>params.cpp
1>plate_detect.cpp
1>plate_judge.cpp
1>plate_locate.cpp
1>plate_recognize.cpp
1>deface.cpp
1>gdts.cpp
1>mc_data.cpp
1>ann_train.cpp
1>..\src\train\ann_train.cpp(241): warning C4477: “fprintf”: 格式字符串“%d”需要类型“int”的参数,但可变参数 1 拥有了类型“::size_t”
1>..\src\train\ann_train.cpp(241): note: 请考虑在格式字符串中使用“%zd”
1>..\src\train\ann_train.cpp(264): warning C4477: “fprintf”: 格式字符串“%d”需要类型“int”的参数,但可变参数 1 拥有了类型“unsigned __int64”
1>..\src\train\ann_train.cpp(264): note: 请考虑在格式字符串中使用“%zd”
1>svm_train.cpp
1>train.cpp
1>kv.cpp
1>program_options.cpp
1>util.cpp
1>helper.cpp
1>正在编译...
1>lbp.cpp
1>mser2.cpp
1>corrected_svm.cpp
1>erfilter.cpp
1>libeasypr.vcxproj -> D:\net\EasyPRCSharp\x64\Release\LibLPS.lib
1>已完成生成项目“libeasypr.vcxproj”的操作。
2>------ 已启动全部重新生成: 项目: CreateDLL, 配置: Release x64 ------
2>stdafx.cpp
2>CreateDLL.cpp
2>dllmain.cpp
2>xmlParser.cpp
2>CreateDLL.obj : warning LNK4197: 多次指定导出“get_license_str”;使用第一个规范
2> 正在创建库 D:\net\EasyPRCSharp\x64\Release\CreateDLL.lib 和对象 D:\net\EasyPRCSharp\x64\Release\CreateDLL.exp
2>正在生成代码
2>All 5282 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
2>已完成代码的生成
2>CreateDLL.vcxproj -> D:\net\EasyPRCSharp\x64\Release\CreateDLL.dll
2>CreateDLL.vcxproj -> D:\net\EasyPRCSharp\x64\Release\CreateDLL.pdb (Full PDB)
2>已完成生成项目“CreateDLL.vcxproj”的操作。
========== 全部重新生成: 成功 2 个,失败 0 个,跳过 0 个 ==========

运行后点文件->打开错误信息如下:
{"值不能为 null。\r\n参数名: ptr"}

求问,该咋整 ><

无法打开图片,../../../../x64/Release/CreateDLL.dll无法导入

代码中有相对地址‘../../../../x64/Release/CreateDLL.dll’,请问这个应该如何更改?

private void button1_Click(object sender, EventArgs e)
{
this.label1.Text = "正在处理中,请稍等......";
Application.DoEvents();
DllInvoke dll = new DllInvoke(@"../../../../x64/Release/CreateDLL.dll");
do_lps_func lps = (do_lps_func)dll.Invoke("do_lps", typeof(do_lps_func));

        //folder_path = @"L:\Users\zc\Desktop\native_test";
        DirectoryInfo TheFolder = new DirectoryInfo(folder_path);

LPS加载CreateDLL.dll出错

用vs2017和opencv3.1已经成功生成CreateDLL.dll了,但是调用的时候GetDelegateForFunctionPointer方法的api句柄参数却是空的,我控制台输出了hLib这个句柄,值是0,是不是表示加载dll出错了?

提示说找不到路径,详细的报错信息如下所示

未处理System.IO.DirectoryNotFoundException
  HResult=-2147024893
  Message=未能找到路径“E:\ChromeDownloads\EasyPR-DLL-CSharp-master\EasyPR-DLL-CSharp-master\test_interface\bin\x64\Debug\EasyPR-DLL-CSharp-master\resources\image\interface\show_detect”的一部分。

上面是出错的位置,但是检查了路径没问题啊。

  Source=mscorlib
  StackTrace:
       在 System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
       在 System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost)
       在 test_interface.SinglePic.打开ToolStripMenuItem_Click(Object sender, EventArgs e) 位置 e:\ChromeDownloads\EasyPR-DLL-CSharp-master\EasyPR-DLL-CSharp-master\test_interface\SinglePic.cs:行号 67
       在 System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
       在 System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
       在 System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
       在 System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
       在 System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
       在 System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
       在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       在 System.Windows.Forms.Control.WndProc(Message& m)
       在 System.Windows.Forms.ToolStrip.WndProc(Message& m)
       在 System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
       在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       在 test_interface.Program.Main() 位置 e:\ChromeDownloads\EasyPR-DLL-CSharp-master\EasyPR-DLL-CSharp-master\test_interface\Program.cs:行号 19
       在 System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       在 System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

上面是栈异常的所有详细代码

error C010

我在编译CreateDLL的时候,xmlParser会提示:unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?

有没有人出这个错误? 尝试读取或写入受保护的内存。这通常指示其他内存已损坏。

“test_interface.exe”(CLR v4.0.30319: DefaultDomain): 已加载“C:\windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll”。已跳过加载符号。模块进行了优化,并且调试器选项“仅我的代码”已启用。
“test_interface.exe”(CLR v4.0.30319: DefaultDomain): 已加载“E:\BaiduYunDownload\EasyPR-DLL-CSharp-master\test_interface\bin\x64\Release\test_interface.exe”。已跳过加载符号。模块进行了优化,并且调试器选项“仅我的代码”已启用。
模块“test_interface.exe”的符号未加载。

  1. 使用调试生成配置或禁用调试选项“启用‘仅我的代码’”。
  2. 检查调试选项下的“符号”设置。“test_interface.exe”(CLR v4.0.30319: test_interface.exe): 已加载“C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll”。已跳过加载符号。模块进行了优化,并且调试器选项“仅我的代码”已启用。
    “test_interface.exe”(CLR v4.0.30319: test_interface.exe): 已加载“C:\windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll”。已跳过加载符号。模块进行了优化,并且调试器选项“仅我的代码”已启用。
    “test_interface.exe”(CLR v4.0.30319: test_interface.exe): 已加载“C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll”。已跳过加载符号。模块进行了优化,并且调试器选项“仅我的代码”已启用。
    “test_interface.exe”(CLR v4.0.30319: test_interface.exe): 已加载“C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll”。已跳过加载符号。模块进行了优化,并且调试器选项“仅我的代码”已启用。
    “test_interface.exe”(CLR v4.0.30319: test_interface.exe): 已加载“C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll”。已跳过加载符号。模块进行了优化,并且调试器选项“仅我的代码”已启用。
    “test_interface.exe”(CLR v4.0.30319: test_interface.exe): 已加载“C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll”。已跳过加载符号。模块进行了优化,并且调试器选项“仅我的代码”已启用。
    “test_interface.exe”(CLR v4.0.30319: test_interface.exe): 已加载“C:\windows\Microsoft.Net\assembly\GAC_MSIL\mscorlib.resources\v4.0_4.0.0.0_zh-Hans_b77a5c561934e089\mscorlib.resources.dll”。模块已生成,不包含符号。

“System.AccessViolationException”类型的未经处理的异常在 test_interface.exe 中发生

尝试读取或写入受保护的内存。这通常指示其他内存已损坏。

没法编译通过

最初是无法运行rc.exe,然后重装了电脑就是 :
严重性 代码 说明 项目 文件 行 禁止显示状态
错误 D8021 无效的数值参数“/wd4267,4819” CreateDLL D:\opencv3.1.0\EasyPR-DLL-CSharp-master\CreateDLL\cl 1

请问有成功运行该程序的伙计吗?

选择测试文件后,报Vector Subscript Out of range

项目编译通过之后,从singlepic界面选择文件
经过跟踪发现在
chars_identify.cpp 文件大约100行的地方报错
报错代码为:
ann_->predict(featureRows,output );
image

编译环境为 vs2017 opencv 版本为 3.1.0
环境变量的配置为:/opencv/build/x64/vc14/bin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.