theta = linspace(0, 2*pi, 256); I = repmat((-cos(2*theta) + 1)/2, [256 1]); h = imshow(I); % Save the handle for use below.As far as MATLAB itself is concerned, this is a scaled indexed image being displayed in a figure with a grayscale colormap installed. Here are the key properties that have been set to control the image display:
ans = scaledThe toolbox convention is that, for floating-point images, 0 is displayed as black and 1 is displayed as white.
ans = 0 1
map = get(gcf, 'Colormap'); map(1:5, :) % Display the first few colormap colors
ans = 0 0 0 0.0039 0.0039 0.0039 0.0078 0.0078 0.0078 0.0118 0.0118 0.0118 0.0157 0.0157 0.0157imshow (and imtool) handle all these details for you.
imshow(I, [0.4 0.6])
bw = imread('text.png'); islogical(bw)
ans = 1
h = imshow(bw);Image Processing Toolbox Users Guide has a section called "Image Types in the Toolbox." This section describes the image types binary, indexed, grayscale, and truecolor, and it explains important dynamic range conventions as well. This is essential information for you to know in order to use the toolbox effectively.
Get the MATLAB code Published with MATLAB® 7.2
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.