0

当我尝试在 C# 中使用Emguavi 文件中捕获视频时,我得到了空引用异常。

捕获捕获 = 新捕获(“somepath.avi”)

我的操作系统上安装了 K-Lite 编解码器。这是堆栈跟踪:

>     at Emgu.CV.Capture..ctor(String fileName)
>     
>        at HelloWorld.Program.Main() in D:\5th year stuff\1st Semester\Computer
> Vision\libemgucv-2.1.0.793-win64\Emgu.CV.Example\HelloWorld\Program.cs:line
> 30
>     
>        at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
>     
>        at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
>     
>        at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
>     
>        at System.Threading.ThreadHelper.ThreadStart()
4

2 回答 2

2

仔细检查您的 avi 文件是否与 opencv 兼容。您应该使用 mencoder 并使用适当的编解码器对其进行转换,如此所述。一种受支持的编解码器是原始 I420 编解码器。您可以使用此命令使用 mencoder 将您的 avi 转换为 I420

mencoder inputVideo.avi -ovc raw -vf format=i420 -o convertedVideo.avi
于 2010-12-17T00:02:58.073 回答
0

我遇到了同样的问题。我使用名为 FFmpeg 的视频编解码器将 .MOV 文件转换为 .AVI,当我将 opencv_ffmpeg.dll 添加到我的项目中时,它就可以工作了。该dll位于Emgu包的bin目录中。尝试找出您的 .avi 文件正在使用什么编解码器,并检查该编解码器是否有 dll。将dll复制到项目目录,记住将“Copy if newer”设置为文件的“Copy local”属性,看看它是否有效。我使用了一个名为“Pazera Free Mov to Avi”的软件来转换具有不同编解码器选项的视频文件。

于 2012-05-30T18:37:26.283 回答