摘要:本文主要向大家介绍了Photoshop入门学习之PS 图像调整算法——自动对比度 (Auto Contrast),通过具体的内容向大家展现,希望对大家Photoshop入门学习有所帮助。
本文主要向大家介绍了Photoshop入门学习之PS 图像调整算法——自动对比度 (Auto Contrast),通过具体的内容向大家展现,希望对大家Photoshop入门学习有所帮助。
<
PS 给出的定义:
Enhance Monochromatic Contrast: Clips all channels identically. This preserves the overall color relationship while making highlights appear lighter and shadows appear darker. The Auto Contrast command uses this algorithm.
和自动色阶不一样的地方在于,自动对比度不是三个通道分别调整,而是三个通道同时调整,可以先获取图像的亮度信息,然后根据 clipping percentage 对亮度进行动态范围的拉伸,根据拉伸前后亮度的比率,可以同比例调整R,G,B 三个通道,这样调整的图像不会出现色偏的问题。
先拉伸亮度的动态范围,可以借用自动色阶里的函数。
function I_out=F_color(I, percent)
%%% the tonal range of the input image is 0-1.
[row, col]=size(I);
I_sort=sort(I(:));
I_out=I;
%%% based on the clipping percentage,
%%% compute the upper and lower boundaries
if (percent==0)
I_min=min(I_sort)
I_max=max(I_sort)
else
I_min=I_sort(floor(row*col*percent))
I_max=I_sort(floor(row*col*(1-percent)))
end
for i=1:row
for j=1:col
if(I(i,j)<I_min)
I_out(i,j)=I_min;
elseif(I(i,j)>I_max)
I_out(i,j)=1;
else
I_out(i,j)=(I(i,j)-I_min)*(1-I_min)/(I_max-I_min)+I_min;
end
end
end
利用拉伸前后亮度的比率,同比例调整R,G,B三个通道。
clc;
clear all;
Image=imread('8.jpg');
Image=double(Image)/255;
imshow(Image);
R=Image(:,:,1);
G=Image(:,:,2);
B=Image(:,:,3);
I=R*0.2989+G*0.5871+0.1140*B;
I=I/(max(I(:)));
percent=0.001;
I_out=F_color(I, percent);
delta=0.0001;
K=(I_out+delta)./(I+delta);
Image_out(:,:,1)=R.*K;
Image_out(:,:,2)=G.*K;
Image_out(:,:,3)=B.*K;
figure, imshow(Image_out);
本文由职坐标整理并发布,希望对同学们有所帮助。了解更多详情请关注常用软件Photoshop频道!
您输入的评论内容中包含违禁敏感词
我知道了
请输入正确的手机号码
请输入正确的验证码
您今天的短信下发次数太多了,明天再试试吧!
我们会在第一时间安排职业规划师联系您!
您也可以联系我们的职业规划师咨询:
版权所有 职坐标-一站式IT培训就业服务领导者 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
沪公网安备 31011502005948号