[rows, cols, ~] = size(img);
leftHalf = img(:, 1:floor(cols/2), :);
rightHalf = img(:, floor(cols/2)+1:end, :);
leftHSV = rgb2hsv(leftHalf);
rightHSV = rgb2hsv(rightHalf);
beigeThreshold = [0.1 0.1 0.5; 0.2 0.3 1];
blueThreshold = [0.55 0.4 0.2; 0.75 1 1];
beigeMaskLeft = (leftHSV(:,:,1) >= beigeThreshold(1,1) & leftHSV(:,:,1) <= beigeThreshold(2,1)) & ...
(leftHSV(:,:,2) >= beigeThreshold(1,2) & leftHSV(:,:,2) <= beigeThreshold(2,2)) & ...
(leftHSV(:,:,3) >= beigeThreshold(1,3) & leftHSV(:,:,3) <= beigeThreshold(2,3));
blueMaskRight = (rightHSV(:,:,1) >= blueThreshold(1,1) & rightHSV(:,:,1) <= blueThreshold(2,1)) & ...
(rightHSV(:,:,2) >= blueThreshold(1,2) & rightHSV(:,:,2) <= blueThreshold(2,2)) & ...
(rightHSV(:,:,3) >= blueThreshold(1,3) & rightHSV(:,:,3) <= blueThreshold(2,3));
beigeProportion = sum(beigeMaskLeft(:)) / numel(beigeMaskLeft);
blueProportion = sum(blueMaskRight(:)) / numel(blueMaskRight);
blackMask = (img(:,:,1) < blackThreshold) & (img(:,:,2) < blackThreshold) & (img(:,:,3) < blackThreshold);
blackProportion = sum(blackMask(:)) / numel(blackMask);