Computer Vision HW1
Computer Vision HW1
Homework 1:
White Balance
Pesented by:
Zahraa muhaned mohammed faeq
MSc stg 1
HW1: White Balance
1. Implement the grey world and the robust white patch algorithms using MATLAB.
a. grey_world
imread('C:\Users\ahmed\Pictures\257531\صور.jpg');
image = im2double(image);
% average
avg_r = mean2(image(:,:,1));
avg_g = mean2(image(:,:,2));
avg_b = mean2(image(:,:,3));
imshow(balanced_image);
b. robust_white_patch
image = imread('C:\Users\ahmed\Pictures\ph\3.jpg');
image = im2double(image);
max_r = max(max(image(:,:,1)));
max_g = max(max(image(:,:,2)));
max_b = max(max(image(:,:,3)));
scale_r = 1 / max_r;
scale_g = 1 / max_g;
scale_b = 1 / max_b;
balanced_image = image;
balanced_image(:,:,1) = image(:,:,1) * scale_r;
balanced_image(:,:,2) = image(:,:,2) * scale_g;
balanced_image(:,:,3) = image(:,:,3) * scale_b;
GreyPoint
Grey Point(R,
(R,G,G,B):B):55.67,
0.47,54.35,
0.51,56.76
0.42
Grey Point:
correction 0.4676
factor (R, G, B): 1.00, 1.02, 0.98
o Grey World gave better results because the colors look balanced and the details
are preserved.
3.Repeat step 2 for the robust white patch algorithm. This time report the white point (the 1
percentiles of the R, G, and B channels) for each image.
o Robust White Patch gave better results because it utilized the bright points
in the image.
4.Look for images where both algorithms fail. What criteria do they haveor lack?
Original
Analysis:
o Both algorithms fail because the image contains a dominant color (blue sky) and
uneven lighting.
Original