本文介绍了需要emgu超级分辨率的例子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我正在尝试在EMGU中执行超分辨率。我有一台显微镜USB摄像头,我可以在其中获取文件(或内存)的连续帧。我对C#很新,但有合理的工作知识。我做让Emgu在VS .Net中运行良好,我正在获取并保存图像。 我想执行超分辨率但是找不到任何体面的示例代码或只是示例。有一个例子(链接如下),但我使用的是VS .Net,我很难理解。 请大家非常感谢。 b $ b emgucv / SuperResolution .cs at master·neutmute / emgucv·GitHub [ ^ ] 我尝试过: 搜索了一切。试图从链接实现简短的例子,但根本不工作。需要VS.net中的示例才能让我前进。解决方案 这不是解决方案。这是我到目前为止所尝试的,但它还没有使用EmguCv 3.1: 使用 Emgu.CV; 使用 Emgu.CV.CvEnum; 使用 Emgu.CV.Structure; 使用 Emgu.Util; 使用 Emgu.CV.UI; 使用 Emgu.CV.Superres; .. 。 public void SuperReosultionTest() { Mat frame = new Mat(); // 输入视频框 Mat result = 新 Mat(); // 输出超分辨率图像 FrameSource _frameSource = new FrameSource( 0 ); // 输入帧从WebCam或USB Camera 获取 // FrameSource fs = new FrameSource(video.avi,false); //输入帧从文件中读取 _frameSource.NextFrame(frame); // 输入帧是从WebCam或USB Camera获得的 ImageViewer viewer = new ImageViewer(); viewer.Image = frame; viewer.ShowDialog(); // 显示示例输入框 SuperResolution _superResolution = new SuperResolution(Emgu.CV.Superres.SuperResolution.OpticalFlowType.Btvl,_frameSource); _superResolution.NextFrame(result); // 输出超级分辨率图像 viewer.Image = result; viewer.ShowDialog(); // 显示样本输出超分辨率图像 } 出于某种原因,它总是挂断 SuperResolution _superResolution = new SuperResolution(Emgu.CV.Superres.SuperResolution.OpticalFlowType.Btvl,_frameSource); 我还在寻找解决方案。 我添加后 尝试 {...} catch (){...} 我得到以下内容: OpenCV:当前版本或平台禁用被调用的功能。 所以我将再次尝试使用另一个版本的OpenCV。 我的解决方案是使用CPU,因为我的OpenCV不是GPU构建。 每帧超级约15秒。最有可能的是你可以通过OpenCV / EmguCV GPU构建来提高速度。 最初我认为它因为SuperRes呼叫的长时间延迟而无法正常工作,但是我在VC ++中编译并运行OpenCV示例它也很慢。 如果你想实时做这将是一个问题。 以下是使用EmguCV 3.1.0的最终解决方案 您可能需要其他类文件I / O等: 使用 Emgu.CV; 使用 Emgu.CV.CvEnum; 使用 Emgu.CV.Structure; 使用 Emgu.Util; 使用 Emgu.CV.UI; 使用 Emgu.CV.Superres; 使用 Emgu.CV.Cuda; public void SuperResolutionTest() { Mat frame = new Mat(); // 输入视频框 Mat result = 新 Mat(); // 输出超分辨率图像 // FrameSource _frameSource = new FrameSource(0); //输入帧是从WebCam或USB Camera获得的 FrameSource _frameSource = new FrameSource( video.avi, false ); // 输入框架从文件中读取 _frameSource.NextFrame(frame); // 输入框架从WebCam或USB Camera获得 for ( int i = 0 ; i < 5 ; i ++) { frame.Save( @ c:\ Dev \ superres \ inputFrame + i.ToString( 00)+ 。 PNG); SuperResolution _superResolution = new SuperResolution(Emgu.CV.Superres.SuperResolution.OpticalFlowType.Btvl,_frameSource); _superResolution.NextFrame(result); // 输出超级分辨率图像 result.Save( @ c:\ Dev \ superres \outputFrame + i.ToString( 00)+ .PNG); } } 该程序将使用读取5帧的视频文件流,并使用默认的EmguCV / superres参数生成5个超分辨率图像。使用VC ++ / OpenCV示例代码版本,您可以控制大部分参数以获得超分辨率。 简单但有效! I'm trying to perform super-resolution in EMGU. I have a microscope USB camera where I can acquire sequential frames to files (or memory). I'm pretty new to C# but have reasonable working knowledge. I do have Emgu working well in VS .Net where I'm acquiring and saving images.I want to perform super-resolution but can't find any decent example code or just examples. There's one example (link below), but I'm using VS .Net and I'm having a hard time understanding.Please any help is GREATLY appreciated.emgucv/SuperResolution.cs at master · neutmute/emgucv · GitHub[^]What I have tried:Searched everything. Tried to implement short example from link but not working at all. Need example in VS.net to get me going. 解决方案 This is not a solution. This is what I tried so far, but it is not working yet using EmguCv 3.1:using Emgu.CV;using Emgu.CV.CvEnum;using Emgu.CV.Structure;using Emgu.Util;using Emgu.CV.UI;using Emgu.CV.Superres;...public void SuperReosultionTest() { Mat frame = new Mat(); // input video frame Mat result = new Mat(); // output superresolution image FrameSource _frameSource = new FrameSource(0); // input frames are obtained from WebCam or USB Camera //FrameSource fs = new FrameSource("video.avi",false); // input frames are read from a file _frameSource.NextFrame(frame); // input frames are obtained from WebCam or USB Camera ImageViewer viewer = new ImageViewer(); viewer.Image = frame; viewer.ShowDialog(); // display a sample input frame SuperResolution _superResolution = new SuperResolution(Emgu.CV.Superres.SuperResolution.OpticalFlowType.Btvl, _frameSource); _superResolution.NextFrame(result); // output super resolution image viewer.Image = result; viewer.ShowDialog(); // display sample output superresolution image }For some reason it always hangs up onSuperResolution _superResolution = new SuperResolution(Emgu.CV.Superres.SuperResolution.OpticalFlowType.Btvl, _frameSource);I am still looking for a solution.After I added try{...} catch(){...}I get the following:"OpenCV: The called functionality is disabled for current build or platform."So I will try again with another version of OpenCV.My solution is working with CPU as my OpenCV is not a GPU build.It super-slow about 15 seconds per frame. Most likely you can speed this up with working in OpenCV/EmguCV GPU build.Initially I thought it was not working because of the long delay in SuperRes call, but I compiled and ran the OpenCV sample in VC++ it was also slow.If you want to do this real-time it will be a issue.Here is the final solution that worked for me using EmguCV 3.1.0You might need other class for file I/O etc:using Emgu.CV;using Emgu.CV.CvEnum;using Emgu.CV.Structure;using Emgu.Util;using Emgu.CV.UI;using Emgu.CV.Superres;using Emgu.CV.Cuda;public void SuperResolutionTest() { Mat frame = new Mat(); // input video frame Mat result = new Mat(); // output superresolution image //FrameSource _frameSource = new FrameSource(0); // input frames are obtained from WebCam or USB Camera FrameSource _frameSource = new FrameSource("video.avi", false); // input frames are read from a file _frameSource.NextFrame(frame); // input frames are obtained from WebCam or USB Camera for (int i = 0; i < 5; i++) { frame.Save(@"c:\Dev\superres\inputFrame" + i.ToString("00") + ".png"); SuperResolution _superResolution = new SuperResolution(Emgu.CV.Superres.SuperResolution.OpticalFlowType.Btvl, _frameSource); _superResolution.NextFrame(result); // output super resolution image result.Save(@"c:\Dev\superres\outputFrame"+i.ToString("00")+".png"); } }This program will use an video file stream read 5 frames and generate 5 super resolution images using default EmguCV/superres parameters. With the VC++/OpenCV sample version of the code you can control most of the parameters for super resolution.Simple but it works! 这篇关于需要emgu超级分辨率的例子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-15 09:59