Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

URGENT : imtransform & makeresampler

Status
Not open for further replies.

callingrohit

Computer
Feb 17, 2005
2
HI everyone,

I'm trying to use a customed "imtransform" function.

The Matlab help is very vague about how to use this function. Neither
does it provide an example...

I really don't understand how to do use "makeresampler":

If you are using a custom interpolating kernel, you can specify
interpolant
as a cell array in either of these forms:

{half_width, positive_half} half_width is a positive scalar
designating the
half width of a symmetric interpolating kernel. positive_half is a
vector of
values regularly sampling the kernel on the closed interval [0
positive_half].

{half_width, interp_fcn} interp_fcn is a function handle that returns

interpolating kernel values, given an array of input values in the
interval
[0 positive_half].

Can anybody help?

Thanks a lot!

callingrohit
 
Replies continue below

Recommended for you

"Neither does it provide an example... "

yes it does. 3 in fact.

"Example 1
---------
Apply a horizontal shear to an intensity image.

I = imread('cameraman.tif');
tform = maketform('affine',[1 0 0; .5 1 0; 0 0 1]);
J = imtransform(I,tform);
imshow(I), figure, imshow(J)

Example 2
---------
A projective transformation can map a square to a quadrilateral. In
this example, set up an input coordinate system so that the input
image fills the unit square and then transform the image from the
quadrilateral with vertices (0 0), (1 0), (1 1), (0 1) to the
quadrilateral with vertices (-4 2), (-8 -3), (-3 -5), and (6 3). Fill
with gray and use bicubic interpolation. Make the output size the
same as the input size.

I = imread('cameraman.tif');
udata = [0 1]; vdata = [0 1]; % input coordinate system
tform = maketform('projective',[ 0 0; 1 0; 1 1; 0 1],...
[-4 2; -8 -3; -3 -5; 6 3]);
[B,xdata,ydata] = imtransform(I,tform,'bicubic','udata',udata,...
'vdata',vdata,...
'size',size(I),...
'fill',128);
subplot(1,2,1), imshow(udata,vdata,I), axis on
subplot(1,2,2), imshow(xdata,ydata,B), axis on

Example 3
---------
Register an aerial photo to an orthophoto.

unregistered = imread('westconcordaerial.png');
figure, imshow(unregistered)
figure, imshow('westconcordorthophoto.png')
load westconcordpoints % load some points that were already picked
t_concord = cp2tform(input_points,base_points,'projective');
info = imfinfo('westconcordorthophoto.png');
registered = imtransform(unregistered,t_concord,...
'XData',[1 info.Width], 'YData',[1 info.Height]);
figure, imshow(registered)
"



Cheers

Greg Locock
 
Hi
Thanks for the info. I did go through those examples but still they don't help me bcoz i need to build my own kernel using the following

{half_width, positive_half} half_width is a positive scalar designating the half width of a symmetric interpolating kernel. positive_half is a vector of values regularly sampling the kernel on the closed interval [0 positive_half].

{half_width, interp_fcn} interp_fcn is a function handle that returns interpolating kernel values, given an array of input values in the interval [0 positive_half].

and also for makeresampler.

thanks bye
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor