WebCam example Delphi 10.2
Posted: Fri Mar 03, 2023 10:57 am
Hi,
when I try to use the webcam example I get an error when I press camera on.
It depends on the procedure btnSnapShozClick.
The z.Free is the reason for the error.
But when I remove this line the RAM is getting higher and higher with each Snapshot.
How can I solve this issue?
Thanks.
when I try to use the webcam example I get an error when I press camera on.
It depends on the procedure btnSnapShozClick.
The z.Free is the reason for the error.
But when I remove this line the RAM is getting higher and higher with each Snapshot.
How can I solve this issue?
Thanks.
Code: Select all
procedure TfrmMain.btnSnapShotClick(Sender: TObject);
var
Img: TBitmap;
z : TRVImageWrapper;
begin
if Globalz then
Exit;
globalz := True;
try
image1.Canvas.Lock;
z := RVCamera1.GetSnapShot;
Img := z.Bitmap.GetBitmap;
image1.Picture.Assign(img);
finally
FreeAndNil(Img);
z.Free;
image1.Canvas.Unlock;
end;
Globalz := False;
end;