⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 my_clusters2.m

📁 这是一个去马赛克工具软件
💻 M
字号:
function Results=my_clusters2(Guess,Correct_size)
%This function calculates the real coordinates of the faces from the raw
%guesses and the template sizes used. To do so it groups the local maxima
%that are in a circle of diameter 40% higher thant the average template
%size. This 40% accounts for the fact that the templates are actually
%smaller than the whole head, and that we may start with a guess that is 
%a bit on the side.

%Convert guesses to double to operate over them.
mGuess=double(Guess);

%Calculate the number of guesses and the average template size.
N=size(mGuess,1);
T=mean(Correct_size);
Results=[];
counter=1;

%For each raw guess.
for i=1:N
         test=[];
         %Check if it has been used in a previous cluster
         if (norm(mGuess(i,:))~=0)
             %If not, include it in a new cluster
            test=[test;mGuess(i,:)];
            counter=counter+1;
            %All the following guesses (the previous have already been
            %used)
            for k=(i+1):N
                %Check if the guess has been used, and if it is closer to
                %the original guess than 1.2 the radius of the face.
                if ((norm(mGuess(k,:))~=0)&&(norm((mGuess(k,2:3)-mGuess(i,2:3)))<(1.2.*T/2)))
                    test=[test;mGuess(k,:)];
                    mGuess(k,:)=[0,0,0];
                    counter=counter+1;
                end
            end
            %Make the weighted average of the results to calculate the
            %exact position of the face.
            v=[mean(test(:,1)),sum(test(:,1).*test(:,2))./sum(test(:,1)),sum(test(:,1).*test(:,3))./sum(test(:,1))];
            Results=[Results;v];
            mGuess(i,:)=[0,0,0];
         end
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -