海康视频采集卡函数GetOriginalImage怎样在Delphi中调用? ( 积分: 200 )

  • 主题发起人 主题发起人 恒翔
  • 开始时间 开始时间

恒翔

Unregistered / Unconfirmed
GUEST, unregistred user!
各个老大,紧急求助阿。在系统里面怎样进行抓图。再用到GetOriginalImage这个函数的时候,不知道怎么调用了。请老大们帮忙阿。
 
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;
 
接受答案了.
 
后退
顶部