Working on drawing a rectangle on the Canvas below will increase the memory. There is no memory increase if commented out.
what's the problem?? I can't possibly know.
Try
ObjCount := _imgRef.ObjectsCount;
_imgFind := TImageEnView.Create(nil);
_imgBackground := TImageEnView.Create(nil);
for i := 0 to ObjCount-1 do begin
hObj := _imgRef.GetObjFromIndex(i);
szPara := _imgRef.ObjName[hobj];
if pos('GRID',szPara)>0 then begin
ObjType := otGrid;
end else begin
ObjType := otLine;
end;
if ObjType = otGrid then begin
MyGetString(',',1,szPara,szValue);
cx := szValue.ToInteger();
MyGetString(',',2,szPara,szValue);
cy := szValue.ToInteger();
MyGetString(',',3,szPara,szValue);
nMatch := szValue.ToInteger();
for y := 0 to cy-1 do begin
for x := 0 to cx-1 do begin
_imgFind.Clear;
_imgBackground.Clear;
Core.VisionPro.Get_GridImage(_imgRef,i, cx,cy,x,y,_imgFind,rec_);
_imgBackground.IEBitmap.Width := rec_.Width + nTolerance*2;
_imgBackground.IEBitmap.Height := rec_.Height + nTolerance*2;
imgProcess.IEBitmap.CopyRectTo(_imgBackground.IEBitmap,rec_.Left-nTolerance, rec_.Top-nTolerance,0,0, rec_.Width+nTolerance * 2, rec_.Height+nTolerance * 2);
dRank := Core.VisionPro.FindImage(_imgFind,_imgBackground,frec_);
if dRank < nMatch then begin
imgProcess.IEBitmap.Canvas.Brush.Style :=bsClear;
imgProcess.IEBitmap.Canvas.Pen.Width :=3;
imgProcess.IEBitmap.Canvas.Pen.Color :=clRed;
inc(nNG);
end else begin
imgProcess.IEBitmap.Canvas.Brush.Style :=bsClear;
imgProcess.IEBitmap.Canvas.Pen.Width :=3;
imgProcess.IEBitmap.Canvas.Pen.Color :=clLime;
end;
// imgProcess.IEBitmap.Canvas.Rectangle(rec_);
end;
end;
end;
end;
finally
_imgFind.Free;
_imgBackground.Free;
End;