From: Saurabh Ghorpade on
Hello ,
I am a newbee in Image processing world.
Please help me in understanding the imadjust function's parameters-
J = imadjust(I,[low_in; high_in],[low_out; high_out],gamma)
i m not able to understand second-[low_in; high_in]
third-[low_out; high_out]
and fourth parameter-gamma.

and how the low_in/high-in parameters actually map the image variations.
From: us on
"Saurabh Ghorpade" <ghorpadesaurabh(a)gmail.com> wrote in message <i0q1gp$22d$1(a)fred.mathworks.com>...
> Hello ,
> I am a newbee in Image processing world.
> Please help me in understanding the imadjust function's parameters-
> J = imadjust(I,[low_in; high_in],[low_out; high_out],gamma)
> i m not able to understand second-[low_in; high_in]
> third-[low_out; high_out]
> and fourth parameter-gamma.
>
> and how the low_in/high-in parameters actually map the image variations.

well...
this is the typical sequence of events for most CSSMers:

% step one, get an idea

help imadjust;

% then, along the lines of
% ...a pic is worth a thousand words...
% PLAY with the parameters and look for yourself how the affect the original image...
% note: ML is patient and does not bite if you make a mistake...
% some helpers

help imagesc; % <- and siblings
help subplot;

us
From: ImageAnalyst on
Saurabh Ghorpade:
It can be confusing, especially for floating point images, and even
for uint8 images because those in,out parameters have to be normalized
floating point values in the range 0.0-1.0, not the actual gray levels
like you'd intuitively think. Basically you're telling it what input
intensities you want to map to what output intensities.

Run this demo and hopefully you'll understand. Especially read the
big block of comments near the end, just before I call imadjust().

IMPORTANT: THE NEWSREADER MAY SPLIT SOME LINES INTO TWO. YOU HAVE TO
JOIN THESE SPLIT LINES TOGETHER AGAIN TO GET IT TO RUN.

% Demo of imadjust() for integer images.
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
imtool close all; % Close all imtool figures.
clear; % Erase all existing variables.
workspace; % Make sure the workspace panel is showing.
fontSize = 14;
numberOfSteps = 32;

% Create a numberOfSteps by numberOfSteps gray scale step wedge
image..
grayStepImage = uint8(linspace(0, 255, numberOfSteps));
grayStepImage = repmat(grayStepImage, [numberOfSteps 1]);

% Get the dimensions of the image.
[rows columns numberOfColorBands] = size(grayStepImage)

% Display the original gray scale step wedge image.
subplot(3, 2, 1);
imshow(grayStepImage, []);
axis on; % Display a box around it.
title('Original Grayscale Step Wedge Image', 'FontSize', fontSize);
set(gcf, 'Position', get(0,'Screensize')); % Enlarge figure to full
screen.

% Let's compute and display the histogram.
[pixelCount grayLevels] = imhist(grayStepImage);
subplot(3, 2, 3);
bar(pixelCount);
title('Histogram of original image', 'FontSize', fontSize);
xlim([0 grayLevels(end)]); % Scale x axis manually.

% Let's display a horizontal profile through the image.
subplot(3, 2, 5);
plot(grayStepImage(1, :));
title('Profile Across Original Image', 'FontSize', fontSize);

% Make a second image where grayStepImage has been run through
imadjust.
% Map 0.25*255 into 0.1*255 and 0.75*255 into 0.8*255.
% In other words, gray levels of 64 or less will get mapped into 191,
% and gray levels of 191 or above will all get mapped into 204.
% image2 will be the same data type (uint8) as the input array even
though
% the in and out gray levels need to be floating point numbers
% in the range of 0 - 1.
image2 = imadjust(grayStepImage, [.25 .75], [0.1 0.8]);
% Display it.
subplot(3, 2, 2);
imshow(image2);
title('imadjusted Image', 'FontSize', fontSize);
axis on; % Display a box around it, otherwise 204 blends into the
background.

% Let's compute and display the histogram.
[pixelCount2 grayLevels2] = imhist(image2);
subplot(3, 2, 4);
bar(pixelCount2);
title('Histogram of imadjusted image', 'FontSize', fontSize);
xlim([0 grayLevels2(end)]); % Scale x axis manually.

% Let's display a horizontal profile through the image.
subplot(3, 2, 6);
plot(image2(1, :));
title('Profile Across imadjusted Image', 'FontSize', fontSize);


From: us on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <a06c5cd2-e443-4342-ba40-1632a393d9dc(a)j4g2000yqh.googlegroups.com>...
> Saurabh Ghorpade:
> It can be confusing, especially for floating point images, and even
> for uint8 images because those in,out parameters have to be normalized
> floating point values in the range 0.0-1.0, not the actual gray levels
> like you'd intuitively think. Basically you're telling it what input
> intensities you want to map to what output intensities.
>
> Run this demo and hopefully you'll understand. Especially read the
> big block of comments near the end, just before I call imadjust().
>
> IMPORTANT: THE NEWSREADER MAY SPLIT SOME LINES INTO TWO. YOU HAVE TO
> JOIN THESE SPLIT LINES TOGETHER AGAIN TO GET IT TO RUN.
>
> % Demo of imadjust() for integer images.
> clc; % Clear the command window.
> close all; % Close all figures (except those of imtool.)
> imtool close all; % Close all imtool figures.
> clear; % Erase all existing variables.
> workspace; % Make sure the workspace panel is showing.
> fontSize = 14;
> numberOfSteps = 32;
>
> % Create a numberOfSteps by numberOfSteps gray scale step wedge
> image..
> grayStepImage = uint8(linspace(0, 255, numberOfSteps));
> grayStepImage = repmat(grayStepImage, [numberOfSteps 1]);
>
> % Get the dimensions of the image.
> [rows columns numberOfColorBands] = size(grayStepImage)
>
> % Display the original gray scale step wedge image.
> subplot(3, 2, 1);
> imshow(grayStepImage, []);
> axis on; % Display a box around it.
> title('Original Grayscale Step Wedge Image', 'FontSize', fontSize);
> set(gcf, 'Position', get(0,'Screensize')); % Enlarge figure to full
> screen.
>
> % Let's compute and display the histogram.
> [pixelCount grayLevels] = imhist(grayStepImage);
> subplot(3, 2, 3);
> bar(pixelCount);
> title('Histogram of original image', 'FontSize', fontSize);
> xlim([0 grayLevels(end)]); % Scale x axis manually.
>
> % Let's display a horizontal profile through the image.
> subplot(3, 2, 5);
> plot(grayStepImage(1, :));
> title('Profile Across Original Image', 'FontSize', fontSize);
>
> % Make a second image where grayStepImage has been run through
> imadjust.
> % Map 0.25*255 into 0.1*255 and 0.75*255 into 0.8*255.
> % In other words, gray levels of 64 or less will get mapped into 191,
> % and gray levels of 191 or above will all get mapped into 204.
> % image2 will be the same data type (uint8) as the input array even
> though
> % the in and out gray levels need to be floating point numbers
> % in the range of 0 - 1.
> image2 = imadjust(grayStepImage, [.25 .75], [0.1 0.8]);
> % Display it.
> subplot(3, 2, 2);
> imshow(image2);
> title('imadjusted Image', 'FontSize', fontSize);
> axis on; % Display a box around it, otherwise 204 blends into the
> background.
>
> % Let's compute and display the histogram.
> [pixelCount2 grayLevels2] = imhist(image2);
> subplot(3, 2, 4);
> bar(pixelCount2);
> title('Histogram of imadjusted image', 'FontSize', fontSize);
> xlim([0 grayLevels2(end)]); % Scale x axis manually.
>
> % Let's display a horizontal profile through the image.
> subplot(3, 2, 6);
> plot(image2(1, :));
> title('Profile Across imadjusted Image', 'FontSize', fontSize);
>

exactly...
and - as i said

% some helpers

help imagesc; % <- and siblings
help subplot;

us