procedure GraspVideoPicture(ChannelHandle: Longint; FileName: PChar); //抓图
var
ImgSize : integer;
imageBuf : array[1..704 * 576 * 2] of byte;
begin
if ChannelHandle=-1 then
Exit;
ImgSize:=704 * 576 * 2;
GetOriginalImage(ChannelHandle, @imageBuf, @ImgSize);
if (ImgSize = 704 * 576 * 2) then
SaveYUVToBmpFile(FileName, @imageBuf, 704, 576)
else if (ImgSize = 704 * 480 * 2) then
SaveYUVToBmpFile(FileName, @imageBuf, 704, 480)
else if (ImgSize = 352 * 288 * 2) then
SaveYUVToBmpFile(FileName, @imageBuf, 352, 288)
else if (ImgSize = 352 * 240 * 2) then
SaveYUVToBmpFile(FileName, @imageBuf,352, 240)
else if (ImgSize = 176 * 144 * 2) then
SaveYUVToBmpFile(FileName, @imageBuf, 176, 144)
else if (ImgSize = 176 * 120 * 2) then
SaveYUVToBmpFile(FileName, @imageBuf, 176, 120)
else if (ImgSize = 704 * 240 * 2) then
SaveYUVToBmpFile(FileName, @imageBuf, 704, 240)
else if (ImgSize = 288 * 224 * 2) then
SaveYUVToBmpFile(FileName, @imageBuf, 288, 224)
else if (ImgSize = 256 * 208 * 2) then
SaveYUVToBmpFile(FileName, @imageBuf, 256, 208)
else if (ImgSize = 528 * 384 * 2) then
SaveYUVToBmpFile(FileName, @imageBuf, 528, 384)
else if (ImgSize = 640 * 480 * 2) then
SaveYUVToBmpFile(FileName, @imageBuf, 640, 480);
end;
procedure btnSaveImageClick(Sender: TObject); //截取图片
var
FileName, RootPath, FilePath, NowPath, nowName: string;
oCameraInfo : TCameraInfo;
ImageBuf : array [ 0..704*576*2-1 ] of char;
ImageSize : ulong;
begin
if inttostr(sel) <> '' then
begin
//文件目录
FilePath := FormatDateTime(FilePath_Con, Date) + '/';
//文件名
FileName := FormatDateTime(FileName_Con, Current_Time);
//通道信息
oCameraInfo := CameraInfoList.Objects[sel] as TCameraInfo;
//根目录
RootPath := RootPathInfoArray[oCameraInfo.RootPathNo];
NowPath := RootPath + FilePath + oCameraInfo.CameraName+'/';
ForceDirectories(NowPath);
NowName := NowPath+FileName+'.BMP';
ImageSize:=704*576*2;
GraspVideoPicture(HandleArray[sel], Pchar(NowName));
// SDKError(GetOriginalImage(HandleArray[sel],@ImageBuf,@ImageSize));
// SDKError(SaveYUVToBmpFile(Pchar(NowName),@ImageBuf,704,576));
//提示信息
stbHDVideoRecord.Panels[3].Text := inttostr(sel) + '图片已截取';
end
else
begin
//提示信息
stbHDVideoRecord.Panels[3].Text := '请选择摄像机';
end;
end;