From: Wheeler, Frederick W (Research) <wheeler@cr...>  20040319 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<img1.ni(); i1++) > > for (unsigned j1=0; j1<img1.nj(); j1++) { > > reg.imap (double(i1), double(j1), x0, y0); > > for (unsigned p1=0; p1<img1.nplanes(); 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 