我是TvideoImage的问题,我用来从webCam中捕获图像。我有一个Timage,我使用fVideoImage.setDisplayCanvas(imgCamera.canvas)
设置,第一个运行很酷,但是当我再次尝试打开时,不再有效。图像是白色的。
my code is:
on create:
fVideoImage := TVideoImage.Create;
bActivated := False;
DeviceList := TStringList.Create;
fVideoImage.GetListOfDevices(DeviceList);
cbListaCameras.Items := DeviceList;
DeviceList.Free;
on power button is:
procedure TFormCamera.btnLigarClick(Sender: TObject);
var
camDevice: string;
begin
try
if not(bActivated)then
begin
camDevice := trim(cbListaCameras.Items.Strings[cbListaCameras.ItemIndex]);
if(camDevice = '')then
begin
ShowMessage('Atenção, informe o dispositivo!');
cbListaCameras.SetFocus;
Exit;
end;
fVideoImage.SetDisplayCanvas(imgCamera.Canvas);
fVideoImage.VideoStart(camDevice);
bActivated := True;
lblCameraStatus.Caption := 'Ligada';
lblCameraStatus.Font.Color := clGreen;
end
else
MessageDlg('Atenção, camera já está ligada!', mtWarning, [mbOK], 0);>>
except
bActivated := False;
lblCameraStatus.Caption := 'Desligada';
lblCameraStatus.Font.Color := clRed;
ShowMessage('Atenção, erro ao tentar ligar a camera!');
end;
end;
On close button is:
fVideoImage.VideoStop;
bActivated := false;
imgCamera.Picture := nil;
//imgCamera.Picture.Bitmap.Assign(nil);
Close;
图像为白色。即使我完全免费,我也不知道,因为它发生了,请帮助我。