Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

## RE: [Vxl-users] Scan converting polygons

 RE: [Vxl-users] Scan converting polygons From: Geoffrey Cross - 2002-12-11 16:33:09 ```Afraid vgl_polygon_scan_iterator isn't going to do what you need, but it looks like //: Clip a polygon against another polygon. // The two polygons poly1 and poly2 are combined with each other. // The operation (intersection, union, etc) is given by parameter op. // \relates vgl_polygon vgl_polygon vgl_clip( const vgl_polygon& poly1, const vgl_polygon& poly2, vgl_clip_type op = vgl_clip_type_intersect ); is going to be the closest you'll get. Do something along the lines of for each pixel vgl_polygon pixel = a 1x1 square at the correct position; vgl_polygon intersection = vgl_clip( your_polygon, pixel ); double intensity = vgl_area( intersection ); end Of course, there's probably a one-line solution in matlab... :) Geoff. > -----Original Message----- > From: vxl-users-admin@... [mailto:vxl-users- > admin@...] On Behalf Of Mike.Rogers@... > Sent: Wednesday, December 11, 2002 4:11 PM > To: vxl-users@... > Subject: [Vxl-users] Scan converting polygons > > Hi > > I'm new to VXL and I have a question. > > Can I use VXL to easily draw a filled polygon into an image? > > The trick is that the edges of the polygon need to be set to the > value of the proportion of the pixel that is covered - i.e. > anti-aliased, but this needs to be done exactly as I want to > use the reslting image in a numerical optimisation over the shape of the > polygon. I've looked at vgl_polygon_scan_iterator but > I'm not sure if I can calculate the end point propotions > from this class. > > Does anyone have any advice on how best to proceed coding > up this algorithm with VXL? > > Yours > Mike > > -- > Dr Mike Rogers > Imaging Science and Biomedical Engineering > Stopford Building > University of Manchester > Oxford Road > Manchester > M13 9PT > UK > Email: mike.rogers@... > Phone: +44 161 275 6871 > Fax: +44 161 275 5145 > Web: http://www.isbe.man.ac.uk/~mdr/personal.html > > > > ------------------------------------------------------- > This sf.net email is sponsored by: > With Great Power, Comes Great Responsibility > Learn to use your power at OSDN's High Performance Computing Channel > http://hpc.devchannel.org/ > _______________________________________________ > Vxl-users mailing list > Vxl-users@... > https://lists.sourceforge.net/lists/listinfo/vxl-users ```

 [Vxl-users] Scan converting polygons From: Mike.R - 2002-12-11 16:11:19 ```Hi I'm new to VXL and I have a question. Can I use VXL to easily draw a filled polygon into an image? The trick is that the edges of the polygon need to be set to the value of the proportion of the pixel that is covered - i.e. anti-aliased, but this needs to be done exactly as I want to use the reslting image in a numerical optimisation over the shape of the polygon. I've looked at vgl_polygon_scan_iterator but I'm not sure if I can calculate the end point propotions from this class. Does anyone have any advice on how best to proceed coding up this algorithm with VXL? Yours Mike -- Dr Mike Rogers Imaging Science and Biomedical Engineering Stopford Building University of Manchester Oxford Road Manchester M13 9PT UK Email: mike.rogers@... Phone: +44 161 275 6871 Fax: +44 161 275 5145 Web: http://www.isbe.man.ac.uk/~mdr/personal.html ```
 RE: [Vxl-users] Scan converting polygons From: Geoffrey Cross - 2002-12-11 16:33:09 ```Afraid vgl_polygon_scan_iterator isn't going to do what you need, but it looks like //: Clip a polygon against another polygon. // The two polygons poly1 and poly2 are combined with each other. // The operation (intersection, union, etc) is given by parameter op. // \relates vgl_polygon vgl_polygon vgl_clip( const vgl_polygon& poly1, const vgl_polygon& poly2, vgl_clip_type op = vgl_clip_type_intersect ); is going to be the closest you'll get. Do something along the lines of for each pixel vgl_polygon pixel = a 1x1 square at the correct position; vgl_polygon intersection = vgl_clip( your_polygon, pixel ); double intensity = vgl_area( intersection ); end Of course, there's probably a one-line solution in matlab... :) Geoff. > -----Original Message----- > From: vxl-users-admin@... [mailto:vxl-users- > admin@...] On Behalf Of Mike.Rogers@... > Sent: Wednesday, December 11, 2002 4:11 PM > To: vxl-users@... > Subject: [Vxl-users] Scan converting polygons > > Hi > > I'm new to VXL and I have a question. > > Can I use VXL to easily draw a filled polygon into an image? > > The trick is that the edges of the polygon need to be set to the > value of the proportion of the pixel that is covered - i.e. > anti-aliased, but this needs to be done exactly as I want to > use the reslting image in a numerical optimisation over the shape of the > polygon. I've looked at vgl_polygon_scan_iterator but > I'm not sure if I can calculate the end point propotions > from this class. > > Does anyone have any advice on how best to proceed coding > up this algorithm with VXL? > > Yours > Mike > > -- > Dr Mike Rogers > Imaging Science and Biomedical Engineering > Stopford Building > University of Manchester > Oxford Road > Manchester > M13 9PT > UK > Email: mike.rogers@... > Phone: +44 161 275 6871 > Fax: +44 161 275 5145 > Web: http://www.isbe.man.ac.uk/~mdr/personal.html > > > > ------------------------------------------------------- > This sf.net email is sponsored by: > With Great Power, Comes Great Responsibility > Learn to use your power at OSDN's High Performance Computing Channel > http://hpc.devchannel.org/ > _______________________________________________ > Vxl-users mailing list > Vxl-users@... > https://lists.sourceforge.net/lists/listinfo/vxl-users ```