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://blog.csdn.net/xuexiyanjiusheng/article/details/46944395)

 (博主cnblogs中对应文章:http://www.cnblogs.com/pfli1995/p/4657302.html)


 

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)

   

 

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
imadjust函数是MATLAB图像处理工具箱中的一个函数,用于调整图像的灰度范围。在使用imadjust函数时,可以通过传递参数来指定输入图像和输出图像的灰度范围。引用提供了一篇详细的文章介绍了imadjust函数的用法,并给出了一些实例代码供参考。 在使用imadjust函数时,可以通过stretchlim函数来获取图像的灰度范围,并直接将其传递给imadjust函数。例如,引用给出了一个实例代码,在该代码中,首先使用imread函数读取图像,然后通过stretchlim函数获取图像的灰度范围,并将其传递给imadjust函数进行灰度调整。最后,使用imshow函数和imhist函数分别显示原始图像和调整后的图像。 除了使用stretchlim函数获取灰度范围外,也可以直接通过指定灰度范围的方式来使用imadjust函数。例如,引用给出了另一个实例代码,在该代码中,直接通过指定灰度范围[0.15,0.9]来调整图像的灰度范围。同样地,使用imshow函数和imhist函数分别显示原始图像和调整后的图像。 总结起来,使用imadjust函数可以通过传递参数来调整图像的灰度范围,可以使用stretchlim函数获取图像的灰度范围,也可以直接指定灰度范围来进行调整。根据具体需要,可以选择不同的方式来使用imadjust函数。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [matlab灰度图像调整及imadjust函数的用法详解](https://download.csdn.net/download/weixin_38559992/12855003)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [MATLAB--imadjust函数](https://blog.csdn.net/weixin_53197693/article/details/128302619)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值