C#,WPF将所有视频文件帧都捕获为位图-最好的方法? [英] C#, WPF Grab all Video File Frames as Bitmaps - Best way?

查看:194
本文介绍了C#,WPF将所有视频文件帧都捕获为位图-最好的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的方法是,我尝试了Googling&在过去的几天里,这已经花了很多时间,并且遇到了很多想法,其中很多可能已经过时了.它正在让我大吃一惊!在我开始选择其中之一-MediaDet,AForge等之前,我希望先了解一下目前最简单 WPF到...的方式是什么.

我希望能够逐帧处理视频文件,并能够通过处理和比较连续的帧进行运动检测.我现在可以从我的相机中获得一系列的Jpegs,因此我可以进行处理,并且可以正常工作,但是我需要能够获取vid文件(MOV),以便进行进一步的离线开发和调整.

我宁愿留在WPF框架中(我不太擅长使用互操作性等),也宁愿不使用第三方库来避免长期依赖.在理想的情况下,我只想将文件提供给WPF MediaElement或MediaPlayer并能够在某些Frame更新事件上抓取位图-但我看不到这样做的方法.另外,我的测试剪辑(MOV)很短,因此可以预处理成一系列的Jpegs-但是又如何读取框架?

有什么想法-请保持温柔...我不是专家,并且对Video,GraphBuilders等知之甚少!

非常感谢.
艾伦·史密斯(Alan Smith).

My appolgies, I have tried Googling & Bling this for the past few days and have come across so many ideas many of which may be outdated. It is doing my head in! Before I set off on one of them - MediaDet, AForge etc I would appreciate a sounding of what is the current easiest WPF way to ...

I would like to be able to process a video file frame by frame and do motion detection by processing and comparing consecutive frames. The processing I am OK with as I currently get a series of Jpegs from my Camera and it works, but I need to be able to take a vid file (MOV) in to allow further off line development and tuning.

I would prefer to stay in the WPF framework (I''m not good with interop etc) and prefer not to use third party libraries to avoid longer term dependancies. In an ideal world I would just like to feed the file to a WPF MediaElement or MediaPlayer and be able to snatch the bitmap on some Frame updated event - but I cannot see a way of doing that. Alternatively my test clips (MOV) are short so pre-process into a series of Jpegs - but again how to read the frames?

Any thoughts - please be gentle ... I''m not an expert and know little of Video, GraphBuilders etc!!

Many thanks.
Alan Smith.

推荐答案

我实际上并没有在4.0上构建用于处理媒体的WPF应用程序,但我在3.5位中做到了.实际上,我在这个领域工作了一年半,不幸的是,如果不创建自己的图形(以及DirectShow来回的一堆图)或使用第三方库来帮助您入门.

这里是一个 [
I haven''t actually built WPF apps on 4.0 that deal with media but I did in the 3.5 bits. Actually, I worked in this space for a year and a half, and unfortunately, you''re not going to be able to do it without creating your own graph (and a bunch of back-and-forth with DirectShow) or using a third party library to get you started.

Here''s one[^] that looks promising for what you''re trying to do (and is written by an active blogger). The project has current posts on CodePlex.

This is just a technicality, but a pure WPF solution is not possible. WPF is really more about the display, not file I/O and image processing. You can use it to render the current state of you innards while chugging through your frames, but stand-alone WPF can''t do this one.

Good luck mate.


它不适用于mp4或mov文件!!!
It does not work for mp4 or mov files !!!


这篇关于C#,WPF将所有视频文件帧都捕获为位图-最好的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆