www.gusucode.com > IPCV_Eval_Kit_R2019a_0ce6858工具箱matlab程序源码 > IPCV_Eval_Kit_R2019a_0ce6858/code/demo_files/I2_04_2_color_correction.m

    %% RGB怓嬻娫偺曗惓

%% 夋憸撉傒崬傒
A = imread('foosballraw.tiff');

%% 僨儌僓僀僋 & 僎僀儞挷惍
% RGGB偺儀僀儎乕僷僞乕儞偐傜RGB曗娫)
A = demosaic(A,'rggb');
A = 3*A; % 僎僀儞挷惍
A_sRGB = lin2rgb(A);
figure
imshow(A_sRGB,'InitialMagnification',25)
title('Original Image')

%% 僠僃僢僇乕儃乕僪偺僌儗僀偺埵抲傪巜掕
x = 1510;
y = 1250;
hold on;
plot(x,y,'ro');
light_color = [A(y,x,1) A(y,x,2) A(y,x,3)]

%% 怓挷帺摦曗惓
B = chromadapt(A,light_color,'ColorSpace','linear-rgb');
B_sRGB = lin2rgb(B);
figure
imshow(B_sRGB,'InitialMagnification',25)
title('White-Balanced Image')

%% 曗惓屻偺怓偺妋擣(RGB偑摨偠嫮搙偵側偭偰偄傞)
patch_color = [B(y,x,1) B(y,x,2) B(y,x,3)]

%% 柖偺彍嫀
% 
%% 夋憸撉傒崬傒
A = imread('foggysf2.jpg');
figure, imshow(A);

%% 柖偺彍嫀
B = imreducehaze(A, 0.9, 'method', 'approxdcp');
figure, imshow(B);

%% 暲傋偰昞帵
figure, imshowpair(A, B, 'montage')

%%
% Copyright 2017 The MathWorks, Inc.