Ejemplo n.º 1
0
        public int GetJpegImage(ref byte[] imageBuf)
        {
            // static extern int GetJpegImage(IntPtr hChannelHandle, byte[] ImageBuf, out int Size, uint nQuality);
            imageBuf = new byte[800 * 600 * 2];
            uint size = 800 * 600 * 2;

            HCNetSDK.NET_DVR_JPEGPARA jpegPara = new HCNetSDK.NET_DVR_JPEGPARA();
            jpegPara.wPicSize    = 2;
            jpegPara.wPicQuality = 1;
            string filename = string.Format("C:\\Picture\\{0}_{1}.jpg", _cameraInfo.Name, Guid.NewGuid().ToString());

            //NET_DVR_CaptureJPEGPicture_NEW(LONG lUserID, LONG lChannel, LPNET_DVR_JPEGPARA lpJpegPara, char *sJpegPicBuffer, DWORD dwPicSize,  LPDWORD lpSizeReturned);
            //HCNetSDK.NET_DVR_CaptureJPEGPicture_NEW(_deviceInfo.ServiceID, _cameraInfo.PlayHandle,jpegPara, imageBuf,100, out size);
            HCNetSDK.NET_DVR_CapturePicture(_cameraInfo.PlayHandle, filename);
            // bool brtn= HCNetSDK.NET_DVR_CaptureJPEGPicture(_deviceInfo.ServiceID, _cameraInfo.PlayHandle,ref jpegPara, filename);

            FileStream   stream = new FileStream(filename, FileMode.Open);
            BinaryReader br     = new BinaryReader(stream);

            imageBuf = br.ReadBytes((int)stream.Length);
            br.Close();

            return((int)size);
        }