ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search
 Forum membership is Free!  Click Join to sign-up Username: Password: Save Password Forgot your Password?
 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 New Topic  Reply to Topic  Printer Friendly
Author  Topic

49 Posts

 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.

5778 Posts

 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

49 Posts

 Posted - Oct 13 2020 :  21:32:04 Thank you very much.

49 Posts

 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;

49 Posts

 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;

5778 Posts

 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
Topic
 New Topic  Reply to Topic  Printer Friendly Jump To: Select Forum ImageEn Library for Delphi, C++ and .Net       ImageEn and IEvolution Support Forum  -------------------- Home Active Topics Frequently Asked Questions Member Information Search Page