## Re: [Vxl-users] 2d transformation + resampling

 Re: [Vxl-users] 2d transformation + resampling From: Walter Nunziati - 2004-03-19 15:07:21 ```Wheeler, Frederick W (Research) wrote: >I use the following to resample images according to a homography with >bilinear or bicubic interpolation. You should also look at >vxl_src/core/vil/vil_warp.h. > >Fred Wheeler > > > double x0, y0; > for (unsigned i1=0; i1 for (unsigned j1=0; j1 reg.imap (double(i1), double(j1), x0, y0); > for (unsigned p1=0; p1 switch (interp_mode) { > case 1: > if (x0>=0.0 && x0<=(int(img0.ni())-1) && > y0>=0.0 && y0<=(int(img0.nj())-1)) { > img1(i1,j1,p1) = vil_bilin_interp (img0, x0, y0, p1); > } > break; > case 2: > if (x0>=1.0 && x0<=(int(img0.ni())-2) && > y0>=1.0 && y0<=(int(img0.nj())-2)) { > img1(i1,j1,p1) = vil_bicub_interp (img0, x0, y0, p1); > } > break; > default: > ERROR2("interp mode must be 1, or 2, set to: ", interp_mode); > } > } > } > > > > Frederick, thank you for the code. One thing: the line that actually implement the homography is: reg.imap (double(i1), double(j1), x0, y0); is that right? Where this function comes from? Is that part of vxl? Walter ```

### Thread view

 RE: [Vxl-users] 2d transformation + resampling From: Wheeler, Frederick W (Research) - 2004-03-18 18:11:45 ```I use the following to resample images according to a homography with bilinear or bicubic interpolation. You should also look at vxl_src/core/vil/vil_warp.h. Fred Wheeler double x0, y0; for (unsigned i1=0; i1=0.0 && x0<=(int(img0.ni())-1) && y0>=0.0 && y0<=(int(img0.nj())-1)) { img1(i1,j1,p1) = vil_bilin_interp (img0, x0, y0, p1); } break; case 2: if (x0>=1.0 && x0<=(int(img0.ni())-2) && y0>=1.0 && y0<=(int(img0.nj())-2)) { img1(i1,j1,p1) = vil_bicub_interp (img0, x0, y0, p1); } break; default: ERROR2("interp mode must be 1, or 2, set to: ", interp_mode); } } } > -----Original Message----- > From: Walter Nunziati > Sent: Thursday, March 18, 2004 1:04 PM > To: vxl-users@... > Subject: [Vxl-users] 2d transformation + resampling > > > Hi, > > i need to implement a planar homography between two images > taken from a > rotating/zooming stationary camera. I think that the "right" > class to do > so is vimt_transform_2d, in the vimt package. Is this the > most suitable > solution? Can i choose the resampling method (e.g. linear, > bilinear, ecc.)? > > Thank you very much. > > Walter Nunziati > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > Vxl-users mailing list > Vxl-users@... > https://lists.sourceforge.net/lists/listinfo/vxl-users > ```
 RE: [Vxl-users] 2d transformation + resampling From: Wheeler, Frederick W (Research) - 2004-03-19 15:18:15 ```> Wheeler, Frederick W (Research) wrote: > > >I use the following to resample images according to a homography with > >bilinear or bicubic interpolation. You should also look at > >vxl_src/core/vil/vil_warp.h. > > > >Fred Wheeler > > > > > > double x0, y0; > > for (unsigned i1=0; i1 > for (unsigned j1=0; j1 > reg.imap (double(i1), double(j1), x0, y0); > > for (unsigned p1=0; p1 > switch (interp_mode) { > > case 1: > > if (x0>=0.0 && x0<=(int(img0.ni())-1) && > > y0>=0.0 && y0<=(int(img0.nj())-1)) { > > img1(i1,j1,p1) = vil_bilin_interp (img0, > x0, y0, p1); > > } > > break; > > case 2: > > if (x0>=1.0 && x0<=(int(img0.ni())-2) && > > y0>=1.0 && y0<=(int(img0.nj())-2)) { > > img1(i1,j1,p1) = vil_bicub_interp (img0, > x0, y0, p1); > > } > > break; > > default: > > ERROR2("interp mode must be 1, or 2, set to: > ", interp_mode); > > } > > } > > } > > > > > > > > > Frederick, thank you for the code. One thing: the line that actually > implement the homography is: > > reg.imap (double(i1), double(j1), x0, y0); > > is that right? Where this function comes from? Is that part of vxl? That's right. This is a class I wrote for myself. It is not part of VXL. reg represents a homography, and imap does and inverse mapping (point in image 2 to point in image 1). I should have made that more clear in my last message. Fred ```
 Re: [Vxl-users] 2d transformation + resampling From: Walter Nunziati - 2004-03-19 15:07:21 ```Wheeler, Frederick W (Research) wrote: >I use the following to resample images according to a homography with >bilinear or bicubic interpolation. You should also look at >vxl_src/core/vil/vil_warp.h. > >Fred Wheeler > > > double x0, y0; > for (unsigned i1=0; i1 for (unsigned j1=0; j1 reg.imap (double(i1), double(j1), x0, y0); > for (unsigned p1=0; p1 switch (interp_mode) { > case 1: > if (x0>=0.0 && x0<=(int(img0.ni())-1) && > y0>=0.0 && y0<=(int(img0.nj())-1)) { > img1(i1,j1,p1) = vil_bilin_interp (img0, x0, y0, p1); > } > break; > case 2: > if (x0>=1.0 && x0<=(int(img0.ni())-2) && > y0>=1.0 && y0<=(int(img0.nj())-2)) { > img1(i1,j1,p1) = vil_bicub_interp (img0, x0, y0, p1); > } > break; > default: > ERROR2("interp mode must be 1, or 2, set to: ", interp_mode); > } > } > } > > > > Frederick, thank you for the code. One thing: the line that actually implement the homography is: reg.imap (double(i1), double(j1), x0, y0); is that right? Where this function comes from? Is that part of vxl? Walter ```