从vb.net中的视频捕获静态图像 [英] Capture still images from a video in vb.net

查看:74
本文介绍了从vb.net中的视频捕获静态图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。我有一个项目要做,1有一个我无法在vb.net中解决的问题。我需要从视频中以不同的时间间隔(按顺序)提取静止图像(帧)并将这些图像形成1个单个图像......

即在t1,t2拍摄不同的图像,t3 ....并制作1张单张图片。

Hello. I have a project to do and 1 have a part that I am not being able to tackle in vb.net. I need to extract still images(frames) at different time interval(in order)from a video and takes these images to form 1 single image...
That is taking the different images at t1, t2, t3.... and make 1 single image.

推荐答案

您可以在PictureBox上播放视频。您需要视频类(Microsoft.DirectX.AudioVideoPlayback)。但您也可以尝试在表单中安装Windows Media Player。



以下是使用DirectX播放视频的REDMX5编写的示例代码(首先请添加引用DirectX和DirectXAudioVideoPlayback):



公共类Form1

私有子Form1_Load(ByVal发送者为System.Object,ByVal e As System。 EventArgs)处理MyBase.Load

Dim mVideo As Microsoft.DirectX.AudioVideoPlayback.Video

Dim CMD As New Windows.Forms.OpenFileDialog

Dim PictureBox1作为新图片框{{.Dock = DockStyle.Fill}

Me.Controls.Add(PictureBox1)

CMD.FileName =

CMD.ShowDialog()

mVideo = New Microsoft.DirectX.AudioVideoPlayback.Video(CMD.FileName)'加载文件

mVideo.Owner = PictureBox1'显示在picturebox

mVideo.Play()

End Sub

结束班级



你可以使用PictureBox.Image.Save方法来ge图片。



以下是有关PictureBox的一些信息:http://msdn.microsoft.com/en-us/library/system.windows.forms.picturebox .aspx



这里有一些关于使用PictureBox.Image.Save方法的链接。



PictureBox图像保存给GDI +错误:http://social.msdn.microsoft.com/Forums/en-SG/vbgeneral/thread/F64E7C1B-4CAA-46AF-89B1-00C7806ED7B6



尝试在pictureBox中捕获播放视频的静止图像,并且只获得黑色图像:http://social.msdn.microsoft.com/Forums/eu/csharpgeneral/thread/d167b0b4-bde3-4de0-8c73-bf8e9fa0370e



如果您有任何其他问题,请随时告诉我。
It is possible for you to play the video on the PictureBox. You need the Video Class (Microsoft.DirectX.AudioVideoPlayback). But you also can try to install the Windows Media Player in your form.

Here is a sample code written by REDMX5 using DirectX to play the video (firstly, please add references to DirectX and DirectXAudioVideoPlayback):

Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim mVideo As Microsoft.DirectX.AudioVideoPlayback.Video
Dim CMD As New Windows.Forms.OpenFileDialog
Dim PictureBox1 As New PictureBox With {.Dock = DockStyle.Fill}
Me.Controls.Add(PictureBox1)
CMD.FileName = ""
CMD.ShowDialog()
mVideo = New Microsoft.DirectX.AudioVideoPlayback.Video(CMD.FileName) 'Load the file
mVideo.Owner = PictureBox1 'Show in the picturebox
mVideo.Play()
End Sub
End Class

You can use PictureBox.Image.Save method to get the picture.

Here is some information about PictureBox: http://msdn.microsoft.com/en-us/library/system.windows.forms.picturebox.aspx

Here is some links about using PictureBox.Image.Save method.

PictureBox Image Save give GDI+ error: http://social.msdn.microsoft.com/Forums/en-SG/vbgeneral/thread/F64E7C1B-4CAA-46AF-89B1-00C7806ED7B6

Try to capture still image of a playing video in pictureBox and only got a black image: http://social.msdn.microsoft.com/Forums/eu/csharpgeneral/thread/d167b0b4-bde3-4de0-8c73-bf8e9fa0370e

If you have any additional questions, please feel free to let me know.


请参考以下链接:

从视频文件中提取帧 [ ^ ]

如何提取视频使用MPlayer的静态帧 [ ^ ]

如何使用MPlayer提取视频静止帧 [ ^ ]

从视频文件中提取帧 [ ^ ]





- Amit
Refer the links below:
Extract Frames from Video Files[^]
How to Extract Video Still Frames with MPlayer[^]
How to Extract Video Still Frames with MPlayer[^]
Extract frames from video files[^]


--Amit


这篇关于从vb.net中的视频捕获静态图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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