function [ num ] = TextureCalc( data, x, y ) %TEXTURECALC Calculates a number representitive of the classification % of x, y. num = TextureCalc(data,x,y) maxvalue = 500; datasize = size(data); z_size = datasize(3); x_size = datasize(2); y_size = datasize(1); index = 1; %hist = double(zeros(256,1)); for zindex=1:z_size for xindex=1:x_size for yindex=1:y_size % We can use the distance from x, y in order to set the % weight on the values. % How do we calculate a single number? distance = sqrt((x - xindex)^2 + (y - yindex)^2); if distance == 0 distance = 1; end v = ceil(maxvalue/(distance^2)); for i=1:v hist(index) = data(yindex,xindex,zindex); index = index + 1; end %hist(data(yindex,xindex,zindex)+1) = hist(data(yindex,xindex,zindex)+1) + maxvalue/(distance^2); end end end num = hist; end