% Fig. 3.10
% Using Logical Indexing
% Dr. W.D.Pan, UAH

I = imread('Fig0310(b)(washed_out_pollen_image).tif');
% imshow(I);
 
% Output images
J_t = I; % Using thresholding
J_p = I; % Using piecewise-linear tranformations

L = 256;
m = mean2(I);

r1 = min(min(I));
s1 = 0;
r2 = max(max(I));
s2 = L-1;


% Thresholding
J_t (I >= m) = L-1;
J_t (I < m) = 0;

% Piecewise-linear transformations

index = (I >= r1 & I <= r2);
J_p(index) = floor( s1 + double((I(index) - r1)) * double((s2 - s1)) / double((r2 - r1)));





