Loren on the Art of MATLAB

Turn ideas into MATLAB


Loren on the Art of MATLAB has been archived and will not be updated.

Tire Rotation

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
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);

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);

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);

Quick Ideas?

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.

Published with MATLAB® 7.5

  • print


コメントを残すには、ここ をクリックして MathWorks アカウントにサインインするか新しい MathWorks アカウントを作成します。