Пример #1
0
        private void FrameCallBack(IntPtr lwnd, IntPtr lpVHdr)
        {
            if (this.RecievedFrame != null)
            {
                ShowVideo.VIDEOHDR videoHeader = new ShowVideo.VIDEOHDR();
                byte[]             VideoData;
                videoHeader = (ShowVideo.VIDEOHDR)ShowVideo.GetStructure(lpVHdr, videoHeader);
                VideoData   = new byte[videoHeader.dwBytesUsed];
                ShowVideo.Copy(videoHeader.lpData, VideoData);



                IntPtr         hdc      = API.CreateCompatibleDC(0);
                API.BITMAPINFO bitheder = new API.BITMAPINFO();
                ShowVideo.SendMessage(this.lwndC, ShowVideo.WM_CAP_GET_VIDEOFORMAT, ShowVideo.SizeOf(bitheder), ref bitheder);
                API.BITMAPINFOHEADER hhh     = bitheder.bmiHeader;
                API.BITMAPINFO       bitinfo = new API.BITMAPINFO();

                IntPtr ht = API.CreateDIBSection(IntPtr.Zero, bitheder, API.DIB_RGB_COLORS, videoHeader.lpData, 0, 0);


                this.RecievedFrame(this, VideoData);
            }
        }
Пример #2
0
 /// <summary>
 /// 获取摄像头实际图像大小
 /// </summary>
 /// <returns></returns>
 public Size GetVideoSize()
 {
     ShowVideo.CAPSTATUS status = new ShowVideo.CAPSTATUS();
     ShowVideo.SendMessage(this.lwndC, ShowVideo.WM_CAP_GET_STATUS, ShowVideo.SizeOf(status), ref status);
     return(new Size(status.uiImageWidth, status.uiImageHeight));
 }