- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试从视频文件中提取特定帧。当我使用 aforge 库播放视频文件时,我有一个想要的帧。我调用了一个新帧事件,如果新帧与我的特定帧匹配,那么它会显示一条消息:“帧匹配”。此特定帧随机出现在视频文件中。这是我的代码:
private void Form1_Load(object sender, EventArgs e)
{
IVideoSource videoSource = new FileVideoSource(@"e:\media\test\a.mkv");
playerControl.VideoSource = videoSource;
playerControl.Start( );
videoSource.NewFrame += new AForge.Video.NewFrameEventHandler(Video_NewFrame );
}
private void Video_NewFrame(object sender, AForge.Video.NewFrameEventArgs eventArgs)
{
//Create Bitmap from frame
Bitmap FrameData = new Bitmap(eventArgs.Frame);
//Add to PictureBox
pictureBox1.Image = FrameData;
//compare current frame to specific fram
if (pictureBox1.Image == pictureBox2.Image)
{
MessageBox.Show("Frame Match");
}
}
pictureBox2.image是我要匹配的固定框。当我播放视频文件并提取新帧时,这段代码工作正常,但我无法将新帧与特定帧进行比较。请指导我如何实现这一目标。
最佳答案
你可以看看: https://github.com/dajuric/accord-net-extensions
var capture = new FileCapture(@"C:\Users\Public\Videos\Sample Videos\Wildlife.wmv");
capture.Open();
capture.Seek(<yourFrameIndex>, SeekOrigin.Begin);
var image = capture.ReadAs<Bgr, byte>();
或者您可以使用标准的 IEnumerable,例如:
var capture = new FileCapture(@"C:\Users\Public\Videos\Sample Videos\Wildlife.wmv");
capture.Open();
var image = capture.ElementAt(<yourFrameIndex>); //will actually just cast image
包含示例。
关于c# - 如何使用 AForge 库提取特定帧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20917099/
我目前正在做一个“自动车牌检测和识别”,我正在使用 AForge.Net;我使用了一个简单的算法; 虽然它不是很有效,但它会满足我的要求。我已经计算出高度、宽度和高度与宽度(高度/宽度)的比率超过40
我的 WinForms .NET 4 C# 应用程序在用户与其交互时记录桌面。 它根据系统的速度使用 AForge FFMPEG 或 VFW 包装器。当然,捕获是在后台线程中完成的。 无论哪种情况,包
我已经编写了一些需要处理大约 3000 张图像的 C# 代码,但是到第 500 张图像时,任务管理器显示该程序使用了 1.5GB 的内存。下面的功能似乎是罪魁祸首之一。我可以在这里做得更好吗?任何帮助
我正在使用 Aforge .NET 框架在我的应用程序中获取网络摄像头,但我总是得到一个全灰色的图像框架。 this.videoSource = new VideoCaptur
我正在玩 AForge。我从 AForge 网站复制粘贴了示例。 using System; using System.Collections.Generic; using System.Linq;
我正在尝试在 Unity 中使用 AForge,但在转换输入数据时遇到了问题。我有一个二维数组,用于存储需要转换为 UnmanagedImage 的像素值。我想出了以下代码,但我不确定它是否是最有效的
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 8 年前。 Improve this qu
我正在尝试学习 Aforge.net。我写了 o 代码,它工作正常,但我只想在我的图像上检测到紫色,但我找不到它是怎么回事。所以任何人都可以帮助我吗?这是我的代码 Bitmap resim = new
有人可以给我一个完整的例子,使用这个用 VB.NET 或 C# 编写的库在 picturebox 中显示流的图像 最佳答案 这是一个非常非常简单的表单,它使用了 AForge.Video.MJPEGS
如何使用此方法: public static void DFT (Complex[] data, Direction direction) 如果我的输入数组是short[] samples?我可以轻松
我正在尝试使用 Aforge.net 开发一个 LPR 系统,我想在我的图像上应用一个过滤器,正如您在此处看到的: Bitmap a = new Bitmap(@"C:\Use
我需要一些帮助将视频从笔记本电脑相机保存到文件。现在我使用代码来搜索图片框上的视频设备和以前的视频。 我试过 AVIFileWrite 但我失败了。 如何使用 VideoFileWriter 来实现我
我正在尝试从视频文件中提取特定帧。当我使用 aforge 库播放视频文件时,我有一个想要的帧。我调用了一个新帧事件,如果新帧与我的特定帧匹配,那么它会显示一条消息:“帧匹配”。此特定帧随机出现在视频文
我尝试使用 AForge 在 C# 中使用 IP 摄像机做一个录制功能,但我无法真正理解编码,因为我是一个新学习者。录制的视频将保存在我的电脑中。 据我所知,此功能是编写/创建视频并将其保存在我的存储
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 1
我正在尝试检测这张图片上的矩形: 使用此代码: static void Main(string[] args) { // Open your image string path = "
我正在使用 AForge 进行运动检测,并且我知道可以设置运动区域。是否可以让它仅在所有定义区域中有运动时触发?如果上面的功能不是现成的,我正在考虑编写它。 目前,我的理解是区域设置为视觉库中 Mot
我需要在图像上查找对象,因此我尝试使用 AForge 库来完成。我从非常简单的图案和图片开始,但识别准确度已经很糟糕了。我正在使用 ExhaustiveTemplateMatching: Exhaus
如何检测视频中的非移动 Blob ? 假设我有一个视频和一个初始背景帧位图。是否有可能检测到不移动的 Blob /对象?并围绕该对象绘制一个矩形? 最佳答案 这让我想起了一种检测地铁上遗忘元素的算法。
我正在尝试在 AForge 中检测矩形内的圆。我已成功确定 Rectangles,但无法在 Rectangle 中找到 circles。如何在 AForge 中找到另一个形状内的形状。 string
我是一名优秀的程序员,十分优秀!