ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Working on drawing a rectangle on the Canvas below will increase the memory.

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
superdev Posted - Apr 23 2023 : 13:26:10
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;

1   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Apr 23 2023 : 17:46:21
Hi

If you access theTCanvas of TIEBitmap, it will change the state to ieTBitmap (i.e. store the image in memory as a TBitmap), which is presumably what is happening here.

https://www.imageen.com/help/TIEBitmap.Location.html


Nigel
Xequte Software
www.imageen.com