You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
clc; % Clear the command window.
fprintf('Beginning to run %s.m ...\n', mfilename);
close all; % Close all figures (except those of imtool.)
clearvars;
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 18;
% Read in input gray scale image.
grayImage = imread('cameraman.tif');
% Using parula with 256 colors.
subplot(2, 2, 1);
imshow(grayImage);
hold on;
cmap = parula(256);
imshow(grayImage, 'Colormap', cmap);
title('Using parula(256)', 'FontSize', fontSize);
colorbar
% Using parula with 256 colors but with every 16'th color black
% to better demarcate intensity ranges.
subplot(2, 2, 2);
imshow(grayImage);
hold on;
cmap2 = parula(256);
cmap2(1:16:end,:) = 0;
imshow(grayImage, 'Colormap', cmap2);
title('Using parula(256)', 'FontSize', fontSize);
colorbar
% Using parula with 256 colors but with only 8 ranges of 32 gray levels
% to better demarcate intensity ranges.
subplot(2, 2, 3);
imshow(grayImage);
hold on;
cmap3 = parula(8);
imshow(grayImage, 'Colormap', cmap3);
title('Using parula(8)', 'FontSize', fontSize);
colorbar
% Using parula with 256 colors but contours
% every 32 gray levels overlaid (this is 8 ranges).
subplot(2, 2, 4);
imshow(grayImage);
hold on;
cmap4 = parula(256);
imshow(grayImage, 'Colormap', cmap4);
title('Using contourf(grayImage, 32)', 'FontSize', fontSize);
colorbar
contourf(grayImage, 16)
g = gcf;
g.WindowState = 'maximized'
The text was updated successfully, but these errors were encountered:
Discretization of colorbars is not properly reflected in the legend.
results in: https://chart-studio.plotly.com/~danton267/1394/using-parula256/#/
supposed to be: https://www.mathworks.com/matlabcentral/answers/uploaded_files/692629/image.png
code:
The text was updated successfully, but these errors were encountered: