Code covered by the BSD License  

Highlights from
Color Image Processing Webinar Files

image thumbnail
from Color Image Processing Webinar Files by Bruce Tannenbaum
Presentation file and color calibration demo.

getMeanForEachSquare (squaresIm, final)
% Copyright 2007 The MathWorks, Inc.
function squareMeans = getMeanForEachSquare (squaresIm, final)
% Get the new values of the squares 
% convert finding the chart to a function and call it here to get the new,
% updated squares
pixRegion = 5;
squares = cell(4,6);
for i = 1:4
    for j = 1:6
        squares{i,j} = squaresIm(round(final{i}(j,2))-...
                    pixRegion:round(final{i}(j,2)+pixRegion), ...
                    round(final{i}(j,1)-pixRegion):round(final{i}(j,1)+pixRegion), :);
    end
end

cform = makecform('srgb2lab');
square = cellfun(@(x,c) applycform(x, cform), squares, 'UniformOutput',...
    false);
squareMeans = cellfun(@(x) mean(mean(lab2double(x))), square,...
    'UniformOutput', false);

Contact us at files@mathworks.com