linear color correction with matlab

조회 수: 2 (최근 30일)
huseyin kara
huseyin kara 2012년 7월 10일
how i can i fix an image by linear correction or how can i apply it without using pixel by pixel color correction
  댓글 수: 3
huseyin kara
huseyin kara 2012년 7월 10일
after i fix the color of image with applying pixel by pixel correction, the images' shapes are not clear for example image have lots of squares. and in pixel by pixel method white which must be for example [230 230 230] became [235 243 255](rgb pixel value and this is gray) and near pixel value of white is not equal to this white. (pixel by pixel means that 3 or more pixels RGB value of an image is taken and obtaining least square matrix then apply it to whole picture.)
huseyin kara
huseyin kara 2012년 7월 10일
original image from camera(manually control contrast etc.)
after pixel by pixel correction

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2012년 7월 10일
You aren't using enough colors to span your color gamut. Three colors is simply not enough. People often use 24 because they use the industry standard x-rite Color Checker Chart. If you use only three (white, blue, and orange), then there are regions of the gamut that will get mapped to crazy, incorrect colors, as you are observing. You need to specify more standard/reference colors.

추가 답변 (1개)

Image Analyst
Image Analyst 2012년 7월 10일
Color correction does not change the shape of anything. What you are seeing are jpeg compression artifacts. You saved the image with a very very low quality factor.
  댓글 수: 2
huseyin kara
huseyin kara 2012년 7월 10일
i saved it png format and without saving (imshow() command) it looks like 2nd picture. my main problem is color values are increased too much such as between -40 and 350. and i try to get between 0 and 255 the image colors go wrong. Can you give me any suggestion about that.
imdir='C:\Users\infodif\Desktop\';
imfile='123.png';
im=imread([imdir, imfile]);
figure, imshow(im)
R=im(:,:,1); G=im(:,:,2); B=im(:,:,3);
r=R(:); g=G(:); b=B(:);
D=[r,g,b];
m=size(im,1); n=size(im,2);
%white pixel example
i11=im(151:160, 301:310, 1);
i12=im(151:160, 301:310, 2);
i13=im(151:160, 301:310, 3);
%blue pixel example
i21=im(251:260, 601:610, 1);
i22=im(251:260, 601:610, 2);
i23=im(251:260, 601:610, 3);
%orange pixel example
i31=im(571:580, 401:410, 1);
i32=im(571:580, 401:410, 2);
i33=im(571:580, 401:410, 3);
W=[i11(:) i12(:) i13(:); i21(:) i22(:) i23(:); i31(:) i32(:) i33(:)];
O=[230*ones(100,3); 34*ones(100,1) 41*ones(100,1) 130*ones(100,1); 232*ones(100,1) 137*ones(100,1) 32*ones(100,1)];
w=[ones(300,1), W];
t=inv(double(w')*double(w))*double(w')*double(O); % correction matrix
M=double([ones(m*n,1), D])*double(t);
Rr=(M(:,1)+30*ones(m*n,1))*(240/320)+5*ones(m*n,1);
Gg=(M(:,2)+67*ones(m*n,1))*(240/359)+0*ones(m*n,1);
Bb=(M(:,3)+36*ones(m*n,1))*(240/333)+4*ones(m*n,1);
%Rr=M(:,1)-0*ones(m*n,1);
%Gg=M(:,2)+50*ones(m*n,1);
%Bb=M(:,3)+0*ones(m*n,1);
for j=0:(n-1)
for i=1:m
rc(i,j+1)=Rr(i+j*m ,:);
gc(i,j+1)=Gg(i+j*m ,:);
bc(i,j+1)=Bb(i+j*m ,:);
end
end
RGB(:,:,1)=rc;
RGB(:,:,2)=gc;
RGB(:,:,3)=bc;
figure, imshow(uint8(RGB))
huseyin kara
huseyin kara 2012년 7월 10일
this matlab code give me almost good results but some color are wrong such as pencil's color(original is green) and cellphone's red lines(became orange)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Filtering and Enhancement에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by