orient.m

来自「一种基于肤色和模板的人脸检测源代码算法。」· M 代码 · 共 25 行

M
25
字号
% Computes the inclination angle of the segmented region.% according to the centroid coordinates (xmean, ymean), and% the segmented region itself.% See reference [5] in the references section for more details.function [theta] = orient(bw,xmean,ymean)[m n] =size(bw);bw=double(bw);a = 0; b = 0; c = 0;for i=1:m,  for j=1:n,     a = a + (j - xmean)^2 * bw(i,j);         b = b + (j - xmean) * (i - ymean) * bw(i,j);     c = c + (i - ymean)^2 * bw(i,j);      end;end;b = 2 * b;theta = atan(b/(a-c))/2;% change from radians to degrees.theta = theta*(180/pi);

⌨️ 快捷键说明

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