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
 How to select a polygon ROI and enlarge it by code

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
zhengyuanyi27 Posted - Oct 13 2020 : 13:16:53
I want to select a polygon ROI and enlarge the ROI by codes.

Three questions:
1. How to get the position (x,y) for each dots of the polygon?
2. How to select a polygon by codes?
3. Is it possible to enlarge the ROI using th codes like: Select( SelX1 - 10, SelY1 - 10, SelX2 - 10, SelY2 - 10 , Selx3 -10, Sely3-10,....,Slex100+10, Sley100+10,....)

Thank you very much.
5   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Oct 14 2020 : 23:11:27
Hi

There is no built in method in ImageEn to do this. You can try using our internal method (but we can't provide technical support for it).

In hyieutils there are scale methods:

procedure IEScalePoints(var rpt: array of TPoint; PointCount: Integer; MinX, MinY, MaxX, MaxY: Integer; MaintainAR: Boolean = False);
procedure IEScaleDPoints(var rpt: array of TDPoint; PointCount: Integer; MinX, MinY, MaxX, MaxY: Double; MaintainAR: Boolean = False);

Which take an array of TDPoint or TPoint and scale all points to be within a rect bounded by (MinX, MinY) and (MaxX, MaxY).



Nigel
Xequte Software
www.imageen.com
zhengyuanyi27 Posted - Oct 14 2020 : 05:12:45
I tried to use selx1, sely1, but failed for polygon ROI.
Example
// Enlarge the selection by ten pixels on all sides
With ImageEnView1 do
begin
  SelectionBase := iesbBitmap;
  Select( SelX1 - 10, SelY1 - 10, SelX2 - 10, SelY2 - 10 );
End;
zhengyuanyi27 Posted - Oct 14 2020 : 05:05:54
Dear Nigel,
Thank you very much for your help.
By learning the example, I could get the points array for the polygon ROI selection, and make the same polygon ROI selection by code. But I don't know how to enlarge the polygon ROI on all sides, for example, Enlarge the polygon ROI selection by ten pixels on all sides. There is one example to show how to "Enlarge the selection by ten pixels on all sides" for a rectangle ROI selection, while I din't find one example for a polygon selection.
The following is the codes to get the points array for the polygon ROI selection, and make the same polygon ROI selection by code.
Could you please teach me how to enlarge the polygon selection on all sides?
Thanks a lot.


procedure TForm1.Button4Click(Sender: TObject);
var
  MyPolySelArray: array of TPoint;
  I: Integer;
begin
  // Create an array of TPoints of the polygon selection in a TImageEnView
  SetLength( MyPolySelArray, ImageEnView1.PolySelCount );
  for I := 0 to ImageEnView1.PolySelCount - 1 do
    MyPolySelArray[ I ] := ImageEnView1.PolySel[ I ];

   //how to modify the points to enlarge the ROI on all sides.
    ???
    ???


  // Create a polygon selection from an array of TPoints
     ImageEnView1.Deselect();
     for I := Low( MyPolySelArray ) to High( MyPolySelArray ) do
     begin
        ImageEnView1.AddSelPoint( MyPolySelArray[I].x, MyPolySelArray[ I ].y );
     end;
     ImageEnView1.EndSelect();
end;
zhengyuanyi27 Posted - Oct 13 2020 : 21:32:04
Thank you very much.
xequte Posted - Oct 13 2020 : 18:45:41
Hi

Please the example at:

https://www.imageen.com/help/TImageEnView.AddSelPoint.html


To convert control coordinates to bitmap ones use:

https://www.imageen.com/help/TImageEnView.XScr2Bmp.html
https://www.imageen.com/help/TImageEnView.YScr2Bmp.html

Nigel
Xequte Software
www.imageen.com