If only rotating tires were really this easy! After graduate school, I drove east for my post-doc at Woods Hole Oceanographic Institution. In late winter, I noticed that my tires still had red dust on them from visiting national parks in Utah. So I took a picture and later realized that my tire wasn't oriented for easily reading the make of the car.
Here's a gray-scale image of my tire photo.
I = imread('tire.tif'); whos I colormap(gray(256)) image(I), axis image, axis off
Name Size Bytes Class Attributes I 205x232 47560 uint8
Next I want to select the hub to look at it more closely. I happen to know that region I want to look at, having already used imcrop interactively earlier to isolate the central portion.
rect = [90 74 41 41] midI = imcrop(I,rect); image(midI), axis image, axis off
rect = 90 74 41 41
Next, I want to resize the image so I can see details better.
midI5 = imresize(midI,5); imshow(midI5)
Looking at the function imrotate, I see I specify the rotation I want in a counterclockwise sense. Eyeballing the angle, I choose 135 degrees.
midI5r = imrotate(midI5, 135); imshow(midI5r)
Here's the rotated tire. Now you know what kind of car I drove across the country some years ago.
Ir = imrotate(I,135); imshow(Ir)
Like today's blog, I occasionally enjoy trying out products in addition to MATLAB, in part so I can learn more about a particular domain or discipline. Have you used MATLAB or other MathWorks tools to teach yourself about some new technology or application? If so, please let me know here.
Get the MATLAB code
Published with MATLAB® 7.5
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.