Those are some native functions of pkg: image, to enhance an image, either as a whole or based on its gray values.
Using a grayscale image, function
imadjust, on line 5, maps the gray scale image values between [.4 .75] to the full range of [0 1]. That way we can highlight a specific range of interest.
imcomplement, on line 6, we can get the obvious.. complementary aka negative of that image. To achieve the same result with
imadjust all we have to do is to properly map the values of [0 1] to [1 0].
stretchlim, on line 7, can be used as an “auto” mode of
imadjust when we don’t need to specifically deal with range mapping. That one stretches the contrast ending up increasing it for all low and highs of the current input image.
pkg load image close all f = imread('My IMGs/XRAY.tif'); enhancedGreyArea = imadjust(f,[0.4 0.75], [0 1]); neg = imcomplement(f); autoEnhanced = imadjust(f, stretchlim(f), ); subplot(2,2,1) imshow(f); title('Original Image') subplot(2,2,2) imshow(enhancedGreyArea); title('Enhanced (mapped) grey values from [.6 .85] to [0 1]') subplot(2,2,3) imshow(neg); title('Negative by Complement') subplot(2,2,4) imshow(autoEnhanced); title('Auto Enhanced, Saturated')