matlab - imadjust function role:
To perform a grayscale transformation of an image, i.e., to adjust the brightness of a grayscale image or the color matrix of a color image
In MATLAB, the image grayscale adjustment is performed by the function imadjust (), which is called in the following format:
J=imadjust( I ) Perform grayscale adjustment of image I
J=imadjust( I,[low_in;high_in],[low_out;high_out]) [low_in;high_in] is the gray scale range to be transformed in the original image, [low_out;high_out] is the gray scale range after the transformation
J=imadjust( I,[low_in;high_in],[low_out;high_out],gamma) This gamma parameter is the way of mapping, the default value is 1, i.e. linear mapping. When gamma is not equal to 1, the mapping is non-linear.
RGB2=imadjust(RGB1,......) This function adjusts the RGB1 of the color image
1. through the function imadjust () to adjust the gray scale image gray scale range
close all;clear all;clc; %pass (a bill or inspection etc)imadjust()function adjusts the gray scale range of a grayscale image I=imread('F:/'); J=imadjust(I,[0.2 0.5],[0 1]); %Adjusting the gray scale range figure; subplot(121),imshow(uint8(I)); subplot(122),imshow(uint8(J));
In the program through the function imadjust () to adjust the gray scale image gray scale range. The original image grayscale range is 0-255, the program will be less than 255 × 0.2 grayscale value set to 0, will be greater than 255 × 0.5 grayscale value is set to 255. the output of the program after running is as follows:
2. through the function imadjust () to adjust the brightness of the grayscale image
close all;clear all;clc; %Adjusting the grayscale image's gray level and display brightness I=imread('F:/'); J=imadjust(I,[0.1 0.5],[0 1],0.4); %Adjusts the image grayscale and adjusts the brightness K=imadjust(I,[0.1 0.5],[0 1],4); %Adjust image grayscale and turn down brightness figure, subplot(131),imshow(uint8(I)); subplot(132),imshow(uint8(J)); subplot(133),imshow(uint8(K));
On the left is the original image, in the middle is the image displayed after adjusting the image grayscale and enhancing the output of the bright color values, and on the right is the image displayed after adjusting the image grayscale and enhancing the output of the dark color values.
3. Color image enhancement through the function imadjust ()
close all;clear all;clc; %imadjust()Enhancement of color images I=imread('F:/'); J=imadjust(I,[0.2 0.3 0;0.6 0.7 1],[]); %imadjust()treat (sb a certain way)RGBImage processing figure, subplot(121),imshow(uint8(I)); subplot(122),imshow(uint8(J));
With the original image on the left and the processed image on the right, you can see that the brightness of the image is significantly enhanced:
4. through the function stretchlim () and the function imadjust () image enhancement
The stretchlim() can be used to calculate the optimal input interval of the grayscale image, i.e., the second parameter in the function imadjust (I, [low_in;high_in], [low_out;high_out]), as a way of realizing the image enhancement, as exemplified below:
close all;clear all;clc; %via the functionstretchlim()cap (a poem)imadjust()Perform image enhancement I=imread(''); M=stretchlim(I); %Getting the optimal interval J=imadjust(I,M,[]); %Adjusting the gray scale range figure, subplot(121),imshow(uint8(I)); subplot(122);imshow(uint8(J));
5. Inversion of gray-scale image transformation with the function imcomplement ()
The inverse transformation of a grayscale image converts pixel values with a grayscale value of 0 to 255, pixel values with a grayscale value of 255 to 0, and pixel values with a grayscale value of x to 255-x. By inverting the grayscale, it is possible to enhance the information of white or gray details against a dark background.
The code is as follows:
close all;clear all;clc; %exploit a functionimcomplement()Realization of grayscale image grayscale inversion I=imread('F:/'); J=imcomplement(I); %Realization of grayscale inversion figure; subplot(121),imshow(uint8(I)); subplot(122),imshow(uint8(J));
summarize
to this article on matlab grayscale image adjustment and imadjust function usage details of the article is introduced to this, more related matlab image grayscale adjustment imadjust function content, please search for my previous articles or continue to browse the following related articles I hope you will support me more in the future!