| 网站首页 | 业界新闻 | 小组 | 交易 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
共有 821 人关注过本帖, 1 人收藏
标题:我想用VB录取屏幕视频任何区域的图像,一秒钟30帧,并且把录取的图像的RBG值 ...
只看楼主 加入收藏
huangjunxing
Rank: 1
等 级:新手上路
帖 子:49
专家分:0
注 册:2014-8-13
结帖率:50%
收藏(1)
 问题点数:0 回复次数:2 
我想用VB录取屏幕视频任何区域的图像,一秒钟30帧,并且把录取的图像的RBG值保存到一个数组中,请问各位大神用哪个函数比较快,谢谢
我想用VB录取屏幕视频任何区域的图像,一秒钟30帧,并且把录取的图像的RBG值保存到一个数组中,请问各位大神用哪个函数比较快,谢谢
搜索更多相关主题的帖子: 图像 保存 一个数 函数 比较 
2017-08-19 23:37
wlrjgzs
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:26
帖 子:212
专家分:1566
注 册:2017-4-10
收藏
得分:0 
你这个用一个函数是搞不定的
2017-08-21 12:12
leziyi
Rank: 1
等 级:新手上路
帖 子:52
专家分:0
注 册:2016-10-30
收藏
得分:0 
程序代码:

Private Declare Function GetDesktopWindow Lib "user32" () As Long

Private Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long

Private Declare Function ReleaseDC Lib "user32" (ByVal hWnd As Long, ByVal hdc As Long) As Long

Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long

Private Const SRCCOPY = &HCC0020 

Public Function Screen(FilePath As String) 

        If FilePath="" Then

           FilePath="App.Path" + "\Screen"

        End If

        Dim lngDesktopHwnd As Long

        Dim lngDesktopDC As Long

        Picture1.AutoRedraw = True

        Picture1.ScaleMode = vbPixels

        lngDesktopHwnd = GetDesktopWindow

        lngDesktopDC = GetDC(lngDesktopHwnd)

        'filePath为截屏要保存的路径
        
        Me.Visible = False

        Me.WindowState = 2

        Picture1.Width = Screen.Width

        Picture1.Height = Screen.Height

        Call BitBlt(Picture1.hdc, 0, 0, Screen.Width, Screen.Height, lngDesktopDC, 0, 0, SRCCOPY)

        Picture1.Picture = Picture1.Image'将截图存放到图片框里

        Call ReleaseDC(lngDesktopHwnd, lngDesktopDC)

        Me.Visible = True

        SavePicture Picture1, FilePath        '保存图片

End Function



你要录取视频的时候,调一下Timer1的Interval,设成33左右,就可以了.

附上公式:

Timer的Interval=1000/帧数

程序代码:

Private Sub Form_Load()

MkDir (App.Path & "\Screen")'新建一个存放截图的文件夹

Private Sub Timer1_Timer()

Screen("App.Path")'开始截图

End Sub

Private Sub Recording_Click()

Staic Start As Boolean

If Start=True Then

 
   Timer1.Enabled=True

   Recording.Caption="停止录制"

Else

   Timer1.Enabled=False

   Recording.Caption="开始录制"

End If

2018-11-08 20:11
快速回复:我想用VB录取屏幕视频任何区域的图像,一秒钟30帧,并且把录取的图像的 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.075016 second(s), 9 queries.
Copyright©2004-2020, BCCN.NET, All Rights Reserved