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)

  

时间: 2024-08-09 06:23:04

imadjust的相关文章

【图像处理Matlab】2 灰度变换 imadjust stretchlim

f=imread('123.tif'); % 读入一幅图片 g=imadjust(f,[0 1],[1 0]); % 负片显示 [imadjust] imadjust(f, [low_in high_in],[low_out high_out],gama) 此处low_out=1 > high_out=0 所以输出的灰度被反转,故而是负片 注意:除了f .gama  所有输入值都被限定在0 1之间 下图显示gama在输入和输出灰度之间的指数关系 [imcomplement]补充 s=imcomp

matlab图像灰度调整——imadjust函数的使用

在MATLAB中,通过函数imadjust()进行图像灰度的调整,该函数调用格式如下: J=imadjust( I )  对图像I进行灰度调整 J=imadjust( I,[low_in;high_in],[low_out;high_out]) [low_in;high_in]为原图像中要变换的灰度范围,[low_out;high_out]为变换后的灰度范围 J=imadjust( I,[low_in;high_in],[low_out;high_out],gamma)  该gamma参数为映射

Opencv图像识别从零到精通(9)----对比度亮度改变

一张图像来说,会有不同的亮暗程度,很多时候都要增强一下,增强的方法有很多,从大量可以说是线性变换和非线性变换,当然这是说空间域的,频率域的暂时不考虑. 线性变换增强,也是对点的操作,如下图 一.点操作,线性增强 两种常用的点过程(即点算子),是用常数对点进行 乘法 和 加法 运算: 两个参数  和  一般称作 增益 和 偏置 参数.我们往往用这两个参数来分别控制 对比度 和 亮度 . 你可以把  看成源图像像素,把  看成输出图像像素.这样一来,上面的式子就能写得更清楚些: 其中,  和  表示

学习笔记(2)---Matlab 图像处理相关函数命令大全

Matlab 图像处理相关函数命令大全 一.通用函数: colorbar  显示彩色条 语法:colorbar \ colorbar('vert') \ colorbar('horiz') \ colorbar(h) \ h=colorbar(...) \ colorbar(...,'peer',axes_handle) getimage 从坐标轴取得图像数据 语法:A=getimage(h) \ [x,y,A]=getimage(h) \ [...,A,flag]=getimage(h) \

oil spill areas mark

clear all; datasub=imread('c:\Users\Administrator\Desktop\dark_spots.png'); [row,col] = size(datasub); flag = zeros(row,col); flag=datasub; figure,imagesc(imadjust(flag)),colormap(gray),title('SAR暗斑目标图像'); se = ones(2); BW = imdilate(flag,se); BW = i

图象处理通用函数

一.通用函数: colorbar 显示彩色条 语法:colorbar \ colorbar('vert') \ colorbar('horiz') \ colorbar(h) \ h=colorbar(...) \ colorbar(...,'peer',axes_handle) getimage 从坐标轴取得图像数据 语法:A=getimage(h) \ [x,y,A]=getimage(h) \ [...,A,flag]=getimage(h) \ [...]=getimage imshow

paper 55:图像分割代码汇总

matlab 图像分割算法源码 1.图像反转 MATLAB程序实现如下:I=imread('xian.bmp');J=double(I);J=-J+(256-1); %图像反转线性变换H=uint8(J);subplot(1,2,1),imshow(I);subplot(1,2,2),imshow(H); 2.灰度线性变换 MATLAB程序实现如下:I=imread('xian.bmp');subplot(2,2,1),imshow(I);title('原始图像');axis([50,250,5

matlab 灰度变换

(1)线性变换: 通过建立灰度映射来调整源图像的灰度. k>1增强图像的对比度:k=1调节图像亮度,通过改变d值达到调节亮度目的:0<k<1减弱对比度:k<0图像较亮区域会变暗,较暗区域会变亮. i = imread('theatre.jpg'); i = im2double(rgb2gray(i)); [m,n]=size(i); %增加对比度 Fa = 1.25; Fb = 0; O = Fa.*i + Fb/255; figure(1), subplot(221), imsh

Selenium Webdriver 学习总结-Jenkins配置(八)

这周单位要做一个人脸美化的项目,查资料遇到这位大牛的博客,地址如下:点击打开链接 我的代码也是在他的基础上进行修改的,但是他对图像的RGB三个通道平等调节,为了适应我的需求,我改成了针对三个通道分别调节.废话不多说,开始上源码 void ImageAdjust(Mat& src, Mat& dst, vector<double> low_in, vector<double> high_in, vector<double> low_out, vector&