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-1gain=0.5; bias=0.25;% adjust the gainp=Log(1-gain)/Log(2.W); 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 biast1=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 ');
Original:
:
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
PS image adjustment--gain and bias