Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

  • Select matrix and copy

  • In MATLAB, paste into variable ("a" in the example below):

First type

>> a= [

then paste (Ctrl^V)

then close bracket, and Enter ]

  • Create the image
>> figure
>> imshow (a)

(or on the same line)

>> figure, imshow(a)
  • Zoom in to see

Color

If the image is intensities, imshow displays a grayscale image. To display in another color,

1) convert to index

2) imshow with colormap

Converting to index just means convert to numbers into the colormap.

>> num_colorsinmap = 256;
>> a_indexed = round( a * 255 );
    • Works for values between 0 and 1; scales 0 to bottom of coloramp, and 1 to top
>> cmap = hot( num_colorsinmap );
  • For other colormap options, hype >> help colormap 
  • Examples include hot, hsv, jet, and with CSPM you get jettop, jetbot
>> figure, imshow(a_indexed, cmap)

You could also do this in one line:

>> figure, imshow( round(a*255), hot(256) )



  • No labels