PS 图像调整— — gain and bias
2015-11-11 15:07
537 查看
clc; clear all; close all; addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm'); Image=imread('4.jpg'); Image=double(Image)/255; % imshow(Image) % set the gain value 0-1 % set the bias value 0-1 gain=0.5; bias=0.25; % adjust the gain p=log(1-gain)/log(0.5); sz=size(Image); T1=Image(:); T1(T1<0.001)=0; T1(T1>0.999)=1.0; ind_1=find(T1>0.001); ind_2=ind_1(find(T1(ind_1)<0.5)); ind_3=find(T1>0.5); ind_4=ind_3(find(T1(ind_3)<0.999)); T1(ind_2)=(2*T1(ind_2)).^p/2; T1(ind_4)=1-(2*(1-T1(ind_4))).^p/2; cc=(1.0/gain-2)*(1.0-2*T1); ind_5=find(T1<0.5); ind_6=find(T1>0.5); T1(ind_5)=T1(ind_5)./(cc(ind_5)+1); T1(ind_6)=(cc(ind_6)-T1(ind_6))./(cc(ind_6)-1.0); % adjust the bias T1=T1.^(log(bias)/log(0.5)); T1=T1./((1.0/bias-2)*(1.0-T1)+1); Image_new=reshape(T1, [sz(1) sz(2) sz(3)]); figure; imshow(Image_new); imwrite(Image_new, 'out.jpg');
原图:
效果图:
相关文章推荐
- 用NFS挂载root出现:NFS: failed to create MNT RPC client, status=-101(-110)
- Rails -- 时间的内置函数和格式说明
- Rails -- ActionController::InvalidAuthenticityToken解决办法
- pyhton基础之aiohttp
- Rails -- 中文字符串截取的函数
- Rails--自动清除开发日志
- Mplayer 1.2 源码分析--main函数
- golang中container/ring包用法
- Timus Online Judge 1651 Shortest Subchain
- No Brainer
- U3D 平行光阴影细节 Directional Shadow Details
- golang中container/heap包用法
- HDU 2389 ——Rain on your Parade——————【Hopcroft-Karp求最大匹配、sqrt(n)*e复杂度】
- main()函数常用的格式:main(int argc,char **argv)
- Active UNIX domain Sockets--------由netstat想到的
- Foxmail 绑定企业邮箱
- LeetCode -- Container With Most Water
- 简单几步,在heroku中部署你的rails项目
- sleep join yield | wait notify notifyAll
- 访百度糯米之 Caused by: libcore.io.ErrnoException: open failed: EACCES (P