%%%%%%%%%%%% ENEE 631 HOMEWORK #2 %%%%%%%%%%%%%%%%% % Color contrast enhancement script % % Daniel Garcia-Romero 2-21-2006 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% caves=imread('caves.jpg'); clouds=imread('clouds.jpg'); %%% Processing color image caves.jpg caves_max_lum=uint8(zeros(768,1024)); caves_color_streched=caves; for i=1:768 for j=1:1024 caves_max_lum(i,j)=max(caves(i,j,:)); % Takes the maximum value of the vector [r,g,b] as the intensity information end; end; [y]=histogram_streching_threshold(caves_max_lum,4,1.5,27,75); % Used the same configuration as in script_hw_2.m for i=1:768 for j=1:1024 caves_color_streched(i,j,:)=double(y(i,j))/max(double(caves_max_lum(i,j)),eps)*double(caves(i,j,:)); end; end; imwrite(caves_color_streched,'caves_color_streched.jpg','jpeg'); %%% Processing color image clouds.jpg clouds_max_lum=uint8(zeros(768,1024)); clouds_color_streched=clouds; for i=1:768 for j=1:1024 clouds_max_lum(i,j)=max(clouds(i,j,:)); % Takes the maximum value of the vector [r,g,b] as the intensity information end; end; [y]=histogram_streching_threshold(clouds_max_lum,.9,2.5,175,212); % Used the same configuration as in script_hw_2.m for i=1:768 for j=1:1024 clouds_color_streched(i,j,:)=double(y(i,j))/max(double(clouds_max_lum(i,j)),eps)*double(clouds(i,j,:)); end; end; imwrite(clouds_color_streched,'clouds_color_streched.jpg','jpeg');