imadjust

imadjust - Adjust image intensity values or colormap

 

    This MATLAB function maps the intensity values in grayscale image I to new

    values in J such that 1% of data is saturated at low and high intensities of I.

 

    J = imadjust(I)

    J = imadjust(I,[low_in; high_in],[low_out; high_out])

    J = imadjust(I,[low_in; high_in],[low_out; high_out],gamma)

    newmap = imadjust(map,[low_in; high_in],[low_out; high_out],gamma)

    RGB2 = imadjust(RGB1,___)

    gpuarrayB = imadjust(gpuarrayA,___)

 

 (本博客系原创,转载请注明出处:http://www.cnblogs.com/pfli1995/p/4657302.html)

 (博主cnds中对应文章:http://blog.csdn.net/xuexiyanjiusheng/article/details/46944395)

 

Description

J = imadjust(I) maps the intensity values in grayscale image I to new values in J such that 1% of data is saturated饱和的at low and high intensities of I. This increases the contrast of the output image J. This syntax is equivalent to imadjust(I,stretchlim(I)).

 

J = imadjust(I,[low_in; high_in],[low_out; high_out]) maps the values in I to new values in J such that values between low_in and high_in map to values between low_out and high_out.

Note If high_out is less than low_out, imadjust reverses the output image, as in a photographic negative.

 

J = imadjust(I,[low_in; high_in],[low_out; high_out],gamma) maps the values in I to new values in J, where gamma specifies the shape of the curve describing the relationship between the values in I and J.

 

newmap = imadjust(map,[low_in; high_in],[low_out; high_out],gamma) transforms the m-by-3 array colormap associated with an indexed image. low_in, high_in, low_out, and high_out must be 1-by-3 vectors. gamma can be a 1-by-3 vector that specifies a unique gamma value for each channel or a scalar that specifies the value used for all three channels. The rescaled colormap newmap is the same size as map.

 

RGB2 = imadjust(RGB1,___) performs the adjustment on each plane (red, green, and blue) of the RGB image RGB1. If low_in, high_in, low_out, high_out, and gamma are scalars, imadjust applies the same mapping to the red, green, and blue components of the image. To specify unique mappings for each color component of the image, specify low_in, high_in, low_out, high_out, and gamma as 1-by-3 vectors.

 

网上的问题

  • % GRAY TRANSFORM
clc;
I=imread ('pout. if')
Imshow (I);
J=imadjust (I, [0.3 0.7], [0 1], 1); %transforms the walues in the %intensity image I to values in J by lineally mapping values

% between 0.3 and 0.7 to values between 0 and 1.
Figure;
Imshow (J);
J=imadjust (I, [0.3 0.7], [0 1], 0.5); % if GAMMA is less than 1, the

% mapping si weighted toward higher (brighter) output values.
Figure;
Imshow (J);
J=imadjust (I, [0.3 0.7], [0 1], 1.5); % if GAMMA is greater than% 1, the mapping si weighted toward lower (darker) output values.
Figure;
Imshow (J)
J=imadjust (I, [0.3 0.7], [1 0], 1); % If TOP<BOTTOM, the output% image is reversed, as in a photographic negative.
Figure;
Imshow (J);

 

  第1次使用imadjust命令,将图像I的[0.3 0.7]之间的灰度值扩展到[0 1]之间,然后保存成图像J;

  第2次使用imadjust命令,将图像I的[0.3 0.7]之间的灰度值扩展到[0 1]之间,然后保存成图像J;不过图像更亮一些,因为最后一个参数是小于1的;

  第3次使用imadjust命令,将图像I的[0.3 0.7]之间的灰度值扩展到[0 1]之间,然后保存成图像J;不过图像更暗一些,因为最后一个参数是大于1的;

  第4次使用imadjust命令,因为参数区间是[1 0],因此就会得到一个反色图像,也就是黑白颠倒的图像!

 

 

  •  已知图像像素的灰度值主要集中在[50,200],因此图像的灰度变换的思想是先将灰度值小于50像素点赋0,大于200赋255,然后在把灰度在[50,200]中的像素进行灰度拉伸到[0,255],这样达到突出图像有用信息,抑制无用信息的目的。

    可是imadjust里的灰度范围是0到1 怎么办呢?

 

    我觉得应该是 [0 255] 相当于 [0 1] 吧,那么 [50 200]就对应的为 [50/255 200/255],相当于[0.196 0.784]也就是J=imadjust(I,[0.196 0.784],[])

 

 

Examples:

  • Adjust Contrast of Grayscale Image

  Read a low-contrast grayscale image into the workspace and display it.

 

  I = imread('pout.tif');

  imshow(I);

  Adjust the contrast of the image so that 1% of the data is saturated at low and high intensities, and display it.

 

  J = imadjust(I);

  figure

  imshow(J)

 

 

 

  • Adjust Contrast of Grayscale Image Specifying Contrast Limits

  Read a low-contrast grayscale image into the workspace and display it.

 

  I = imread('pout.tif');

  imshow(I);

 

  Adjust the contrast of the image, specifying contrast limits.

 

  K = imadjust(I,[0.3 0.7],[]);

  figure

  imshow(K)

 

  •  Adjust Contrast of RGB Image

  Read an RGB image into the workspace and display it.

 

  RGB = imread('football.jpg');

  imshow(RGB)

 

  Adjust the contrast of the RGB image, specifying contrast limits.

 

  RGB2 = imadjust(RGB,[.2 .3 0; .6 .7 1],[]);

  figure

  imshow(RGB2)

   

 

posted @ 2015-07-18 17:50  pfli1995  阅读(942)  评论(0编辑  收藏  举报