The GetDPI Photography Forum

Great to see you here. Join our insightful photographic forum today and start tapping into a huge wealth of photographic knowledge. Completing our simple registration process will allow you to gain access to exclusive content, add your own topics and posts, share your work and connect with other members through your own private inbox! And don’t forget to say hi!

Problem with image shearing!

K

Kipster1203

Guest
Here's my code so far.... I am getting an error at the matrix multiplication, saying they are different sizes...

Code:
img = imread('brain_b2.jpg');               %# Read a sample grayscale image
[nRows,nCols] = size(img); 
[x,y] = meshgrid(1:nRows,1:nCols);
coords = [x(:)'; y(:)']; 
imshow(img);                                %# Displays Image
pause;                                      %# Keeps image on screen
close;                                      %# Hitting any key closes image
  
%# Image Shearing Sv = 0.05 and Sw = 0.1

T = [1 0.1; 0.05 1];
   
newcoords = coords*T;

newimage = interp2(img, newcoords(1,:), newcoords(2,:), 'linear', 0);
%newimage = reshape(newImage,nRows,nCols);   %# Reshape the image data
newimage = uint8(newImage); 
imshow(newimage);
 
Top