我有一個二進制圖像,可以說512x512px。我想計算配對相關性g(x)。到目前爲止,我正在以原始方式按照原始方式逐行執行:計算圖像對的相關性
function Cr = pairCorr(image)
domains = imread(image); % read image
domains(domains>0) = 1; % make sure its binary by setting 1 to values > 0
size = length(domains(:, 1)); % image size
for i=1:size
line = domains(:, i); % take one line...
for j=1:size % and for each distance...
s = line(1:end-size+j);
Cr(i, j) = mean(s); %...calculate Cr as mean
end
end
Cr = mean(Cr); % average all lines
任何想法如何做得更快? 謝謝!
你試過這個:http://nabil.mabrouk.perso.neuf.fr/spip.php?article14? – Dan 2013-02-22 09:36:35