rotated,scaled, and translated image
    8 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
hi,
i want to apply rotation,scale, and translation (all) in one image.
here is my code:
% reading the image
I=imread('cameraman.jpg');
% rotate the image
deg = -30;
I2 = imrotate(I, deg, 'bilinear', 'crop');
% resize the image(scale)
J=imresize(I,[310 310],'nearest');
% translate the image
T = [1 0 0; 0 1 0;70 70 1];
tform_translate = maketform('affine', T);
[I3,xdata,ydata] = imtransform(I,tform_translate);
% imshow(I3,'XData',xdata,'YData',ydata)
all_adjust=I2+J+I3;
imshow(all_adjust)
axis on
axis([0 400 0 400])
----------------------------------------------------------
but when i combine them i'm gettin' this error:
 ??? Error using ==> plus
  Matrix dimensions must agree.
Error in ==> all at 18
all_adjust=I2+J+I3;
-------------------------------------------
tell me what to do ?????????????????
0 Commenti
Risposte (1)
  Walter Roberson
      
      
 il 5 Feb 2012
        I2 contains a rotated image the same size as the original image (because you used 'crop'), and in I3 you store a resized version of the original image. Now it could happen that what you resized to was exactly the same size as the image already was, but most of the time that will not be the case. Then when you try to add the two images of different sizes together, you are going to have a problem.
Are you trying to produce a single image that has three copies of the original image, one rotated, one resized, one translated? Or are you trying to take the original image and rotate it, resize the rotated image, and then translate the resized (rotated) image? Transformed images do not simply add together in order to produce a single final image; transforms themselves do not simply add together either (you have to use matrix multiplication to chain transforms together.)
3 Commenti
Vedere anche
Categorie
				Scopri di più su Geometric Transformation and Image Registration in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

