matlab image gradation adjustment function using --imadjust

In MATLAB, by adjusting gradation image imadjust function (), the function call the following format:

J = imadjust (I) adjusting gradation image I

J = imadjust (I, [low_in; high_in], [low_out; high_out]) [low_in; high_in] grayscale range of the original image to be transformed, [low_out; high_out] converted to grayscale range

J = imadjust (I, [low_in; high_in], [low_out; high_out], gamma) which is a parameter gamma mapping mode, the default value is 1, i.e. linear mapping. When gamma is not equal to 1 when linear mapping

RGB2 = imadjust (RGB1, ......) which function to adjust the color image RGB1

1. () adjust the gray image gradation range by the function imadjust

All Close; Clear All; CLC;
% by imadjust () function to adjust the gradation range of the gradation image
the I = imread ( 'F.: /paohui.jpg');
J = imadjust (the I, [0.2 0.5], [0. 1 ]);% grayscale range adjustment
Figure;
the subplot (121), imshow (uint8 (the I));
the subplot (122), imshow (uint8 (J));
() function to adjust the gray-scale image by the ash in the program imadjust range. 0-255 gray scale range of the original image, the program will be less than 255 × 0.2 gradation value is set to 0, the gray value greater than 255 × 0.5 to 255. After running the following output:

 

2. () adjust the brightness of the image by the gradation function imadjust

All Close; Clear All; CLC;
% gray image gradation adjustment and display luminance
the I = imread ( 'F.: /paohui.jpg');
J = imadjust (the I, [0.1 0.5], [0. 1], 0.4 );% image intensity and increase brightness adjustment
K = imadjust (I, [0.1 0.5], [0 1], 4);% gray image and reduce the brightness adjustment
Figure,
the subplot (131 is), imshow (uint8 ( the I));
the subplot (132), imshow (uint8 (J));
the subplot (133), imshow (uint8 (K));


Left is the original image, the intermediate image gray adjust and enhance the image display after the output value of the bright color of the right to adjust the image display and to enhance the image gray dark values ​​of the output.

3. () enhanced function of the color image imadjust

All Close; Clear All; CLC;
% imadjust () color image enhancement
the I = imread ( 'F.: /pao1.jpg');
J = imadjust (the I, [0 0.2 0.3; 0.6 0.7. 1], []) ;% imadjust () of the RGB image processing
Figure,
the subplot (121), imshow (uint8 (the I));
the subplot (122), imshow (uint8 (J));
the left picture, the right side is the treatment the image can be seen the image brightness is increased significantly:


4. The image enhancement function by stretchlim () function and imadjust ()

May be employed stretchlim () calculates the optimum gray scale image input section, i.e. a function imadjust (I, [low_in; high_in], [low_out; high_out]) The second parameter, in order to achieve image enhancement, the following specific examples :

All Close; Clear All; CLC;
% by image enhancement function stretchlim () and imadjust ()
the I = imread ( 'pout.tif');
M = stretchlim (the I);% for the best interval
J = imadjust (I, M, []);% grayscale range adjustment
Figure,
the subplot (121), imshow (uint8 (the I));
the subplot (122); imshow (uint8 (J));


The inverted gray scale image with a transformed function imcomplement ()

Reverse conversion of the gray image, the pixel-value converting gray value of 0 to 255, the tone value is converted to a pixel value 255 of 0, the pixel value is converted to the gradation value of x 255-x. By grayscale inversion, gray or white to enhance details in dark background.

code show as below:

All Close; Clear All; CLC;
% using the function imcomplement () to achieve gray scale inversion image
the I = imread ( 'F.: /pao1.jpg');
J = imcomplement (the I);% Grayscale inversion
figure ;
the subplot (121), imshow (uint8 (the I));
the subplot (122), imshow (uint8 (J));

 


Original link: https: //blog.csdn.net/ibelievesunshine/article/details/79958899

Guess you like

Origin www.cnblogs.com/Ph-one/p/11567137.html