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.
Some Simple Image Processing
Today I am going to use some features from Image Processing Toolbox. You might also benefit from reading Steve's blog on image processing.
Read an Image
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
Crop the Image
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
Resize the Image
Next, I want to resize the image so I can see details better.
midI5 = imresize(midI,5); imshow(midI5)
Rotate the Image
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)
Check the Tire Rotation
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.
要发表评论，请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。