ImageEn Forum
 Profile    Join    Active Topics    Forum FAQ    Search
 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.

Size
Mode
Format

Message

 Smilies

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 HiThere 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 Softwarewww.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 HiPlease the example at:https://www.imageen.com/help/TImageEnView.AddSelPoint.htmlTo convert control coordinates to bitmap ones use:https://www.imageen.com/help/TImageEnView.XScr2Bmp.htmlhttps://www.imageen.com/help/TImageEnView.YScr2Bmp.htmlNigel Xequte Softwarewww.imageen.com