using function imadjust in matlab to display an output image darker than the orignal image on screen in matlab

You can use the imadjust function in MATLAB to display an output image darker than the original image on the screen.

The imadjust function adjusts the intensity values of an image based on specified input and output ranges. To achieve a darker output image, you need to map the original intensity range to a narrower range of lower values.

Here is an example code to achieve this:

main.m
% Read the original image
originalImage = imread('your_image.jpg');

% Convert the image to grayscale if it is colored
if size(originalImage, 3) > 1
    originalImage = rgb2gray(originalImage);
end

% Adjust the intensity range to make the output image darker
outputImage = imadjust(originalImage, [0.2, 0.8], []);

% Display the original and adjusted image side by side
figure;
subplot(1,2,1), imshow(originalImage), title('Original Image');
subplot(1,2,2), imshow(outputImage), title('Darker Image');
503 chars
16 lines

In this example, the imadjust function is used to adjust the intensity range of the original image to a range from 0.2 to 0.8. The [] argument is used to let MATLAB automatically determine the output range based on the input range.

By specifying a narrower intensity range in the imadjust function, you can make the output image appear darker.

related categories

gistlibby LogSnag