procedure TDvr_Main.GraspVideoPictureBMP(channelNum: integer; FileName: PChar); //抓图<br>var<br> ImgSize : integer;<br> imageBuf : array[1..704 * 576 * 2] of byte;<br>begin<br> if channelNum=-1 then<br> Exit;<br> ImgSize:=704 * 576 * 2;<br> GetOriginalImage(channelNum, @imageBuf, @ImgSize);<br> if (ImgSize = 704 * 576 * 2) then<br> SaveYUVToBmpFile(FileName, @imageBuf, 704, 576)<br> else if (ImgSize = 704 * 480 * 2) then<br> SaveYUVToBmpFile(FileName, @imageBuf, 704, 480)<br> else if (ImgSize = 352 * 288 * 2) then<br> SaveYUVToBmpFile(FileName, @imageBuf, 352, 288)<br> else if (ImgSize = 352 * 240 * 2) then<br> SaveYUVToBmpFile(FileName, @imageBuf,352, 240)<br> else if (ImgSize = 176 * 144 * 2) then<br> SaveYUVToBmpFile(FileName, @imageBuf, 176, 144)<br> else if (ImgSize = 176 * 120 * 2) then<br> SaveYUVToBmpFile(FileName, @imageBuf, 176, 120)<br> else if (ImgSize = 704 * 240 * 2) then<br> SaveYUVToBmpFile(FileName, @imageBuf, 704, 240)<br> else if (ImgSize = 288 * 224 * 2) then<br> SaveYUVToBmpFile(FileName, @imageBuf, 288, 224)<br> else if (ImgSize = 256 * 208 * 2) then<br> SaveYUVToBmpFile(FileName, @imageBuf, 256, 208)<br> else if (ImgSize = 528 * 384 * 2) then<br> SaveYUVToBmpFile(FileName, @imageBuf, 528, 384)<br> else if (ImgSize = 640 * 480 * 2) then<br> SaveYUVToBmpFile(FileName, @imageBuf, 640, 480);<br>end;<br>procedure TDvr_Main.GraspVideoPictureJPG(channelNum: Longint; FileName: PChar); //JPG抓图<br>var<br> ImgSize : integer;<br> imageBuf : array[1..704 * 576 * 2] of byte; //352 * 288 * 2<br> ret,jpegQuality:integer;<br> pFile: File;<br>begin<br> if channelNum=-1 then<br> Exit;<br> ImgSize:=704*576*2;<br> jpegQuality:=50;<br> ret:=GetJpegImage(channelNum,@imageBuf,@ImgSize,jpegQuality);<br> if(ret=0) then<br> begin<br> AssignFile(pFile,FileName );<br> Rewrite(pFile,imgsize);<br> BlockWrite(pFile, imageBuf,1);<br> CloseFile(pFile);<br> end<br>end;<br><br>procedure TDvr_Main.Dvr_CaptureBMPBtnClick(Sender: TObject);//BMP视频截图<br>var<br> FileName, RootPath, FilePath, NowPath, nowName: string;<br> oCameraInfo : TCameraInfo;<br> ImageBuf : array [ 0..704*576*2-1 ] of char;<br> ImageSize : ulong;<br>begin<br> if inttostr(sel) <> '' then<br> begin<br> try<br> FilePath := FormatDateTime('YYYYMMDD', Date) + '/'+inttostr(sel+1)+'路'+'/'; //文件目录<br> FileName := FormatDateTime('hhmmnnss', now); //文件名<br> RootPath := 'd:/截图目录/';<br> NowPath := RootPath + FilePath ;<br> ForceDirectories(NowPath);<br> NowName := NowPath+FileName+'.BMP';<br> GraspVideoPictureBMP(sel, Pchar(NowName));<br> //GraspVideoPictureJPG(sel, Pchar(NowName));<br> StatusBar1.Panels[3].Text := inttostr(sel+1)+'路' + '图片已截取';<br> except<br> showmessage('图片截取过程失败!');;<br> end;<br> end;<br>end;