“System.AccessViolationException”类型的未经处理的异常在 Emgu.CV.dll 中发生

洗砚 2017-07-25 08:04:30
执行时报错网上的资料:用管理员身份运行:netsh winsock reset也不行,下载最新的Net.Framework安装也没结局问题,安装使用的是VS2015,
...全文
2005 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
lchy 2019-01-27
  • 打赏
  • 举报
回复
我是各种试,终于试对了,我是把项目的原来anycpu改为x64 就正常了。我是64位系统(可以解决本机怎么都可以运行,只要发布到其他机器就出错),问题一样,但诱因可能多种 ,希望可以帮到你
张小逗的博客 2017-11-22
  • 打赏
  • 举报
回复
来给你结贴: 告诉你原因,你把里面的两个xml文件属性 复制到输出目录->如果较新则复制 修改成在这样 如果不行,你把Emgu里面的X86和X64复制到你的DeBug里面,就可以了
gsq_gsq_gsq 2017-11-03
  • 打赏
  • 举报
回复
有文件是只读的?
liukun0928 2017-09-09
  • 打赏
  • 举报
回复
System.AccessViolationException means that you're trying to read/write from unmanaged memory that is not accessible to your application. If you're familiar with pointers and C++, I'm sure you've had access violations. (If you don't know about pointers, this might be unclear - let me know and I'll give a better explanation). In managed C#, you never say explicitly which part of memory you want to read from - you just tell which object reference you want to use, and you're given the correct data from memory. This can sometimes be slower than using unmanaged code. My guess is that when Emgu.CV uses unmanaged code to read video files. When reading .mp4 files, it might read too far. I'm not sure why it would do that - it could be a bug in the way Emgu.CV deals with compression. So why does this happen only occasionally? I can guess: the important thing is, AccessViolationException happens only when you read from memory that you are not allowed to access. If you accidently access memory that you did not intend to access, it could find that the piece of memory is inaccessible so you get an AccessViolationException. But it can also find that some other part of the program is using that piece of memory, and then reading from it is fine! Thus, my guess is that if you open the .mpg file first, you have to allocate a lot of memory. Then when opening .mp4 file, Emgu.CV happens to read from the wrong place in memory - but that memory is already accessible by the .mpg file, so it doesn't throw the same exception. Unfortunately, this does not directly address your problem. I hope it helps shed some light on the problem, and maybe from this you can find out if there is a bug someplace else? There is one thing you could check. If you're able to load the .mp4 successfully, are you also able to save both files? If so, are the saved .mp4 and .mpg files exactly the same as the ones you opened, or are they corrupted somehow? If the files become corrupted, it could support the notion that loading the .mp4 accesses bad memory. That would mean loading the .mp4 is bugged, also when it doesn't throw the AccessViolationException.
xian_wwq 2017-07-28
  • 打赏
  • 举报
回复
引用 7 楼 u010304326 的回复:
试了好几遍好像是cvCreateFileCapture的原因
把c api 的原型贴出来 可能dllimport有问题
洗砚 2017-07-26
  • 打赏
  • 举报
回复
引用 5 楼 xian_wwq 的回复:
如果文件存在,但无法访问,试试
1.确保视频文件未损坏
2.设置文件所在文件夹的权限
3.将vs以管理员权限启动
4.如果使用的framework4.0以上,
加上HandleProcessCorruptedStateExceptions属性,
可以帮助查到具体是什么错误
xian_wwq 2017-07-26
  • 打赏
  • 举报
回复
如果文件存在,但无法访问,试试 1.确保视频文件未损坏 2.设置文件所在文件夹的权限 3.将vs以管理员权限启动 4.如果使用的framework4.0以上, 加上HandleProcessCorruptedStateExceptions属性, 可以帮助查到具体是什么错误
洗砚 2017-07-26
  • 打赏
  • 举报
回复
引用 2 楼 xian_wwq 的回复:
这个错误一般是调用的非托管代码中有空指针
或者指针的非法操作
检查所访问的文件是否存在?是否有足够的权限?

这是文件路径,权限怎么设置?
洗砚 2017-07-26
  • 打赏
  • 举报
回复
引用 1 楼 caozhy 的回复:
检查文件是否能读取,文件的格式

这个是我打印出来的路径信息
xian_wwq 2017-07-26
  • 打赏
  • 举报
回复
这个错误一般是调用的非托管代码中有空指针 或者指针的非法操作 检查所访问的文件是否存在?是否有足够的权限?
洗砚 2017-07-26
  • 打赏
  • 举报
回复
试了好几遍好像是cvCreateFileCapture的原因
threenewbee 2017-07-25
  • 打赏
  • 举报
回复
检查文件是否能读取,文件的格式

110,539

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧