[Solved] What is this function in Matlab? [closed]


So I think I’ve figured this one out as well. It would appear that the images are represented as 6 vectors which hold color, texture and position data. So the input of sample image is an Mx6 array which represents an image. The DatabaseImage holds a number of these vector representations

function [out]=Compare(SampleImage,DatabaseImage)
% //define the 6 columns, and initialize some empty arrays
nCol=(3+1+2); % //input appears to be a 6 band vector image ie Mx6
colourN=[];textureN=[];positionN=[];

% //for 1 to number of cols in DatabaseImage / nCol
% //This will be the number of images in DatabaseImage. 
% //so this loop loops over each database vector image
for times=1:size(DatabaseImage,2)/nCol
    % //zero-based index of the first column of the current image
    sp=nCol*(times-1);

    % //this will be the "distance" between the two values in terms of color, texture and position
    % //append each of these to the end of the array. 
    colourN = [colourN norm(SampleImage(:,1:3)-DatabaseImage(:,sp+1:sp+3))];
    textureN=[textureN norm(SampleImage(:,4)-DatabaseImage(:,sp+4))];
    positionN=[positionN norm(SampleImage(:,5:6)-DatabaseImage(:,sp+5:sp+6))];
end

% // then append along the other dimension to output as one matrix
out=[colourN;textureN;positionN];

solved What is this function in Matlab? [closed]