[已答复] 关于函数或者变量无法识别的问题

[复制链接]
Fighting's6 发表于 2021-11-25 10:03:17
%%
% Sort zenith angles of interior pixels into descending order
[~ , idx ]= sort ( theta ( interior ) ,1 , 'descend ');

[ col , row ]= meshgrid (1: cols ,1: rows );
r = row ( interior );
c = col ( interior );

% At each iteration , we choose the unprocessed pixel with smallest zenith
% angle that has at least one neighbour
while ~ isempty ( idx )
    flag = false ;
    selected = 1;
    % Consider pixels in ranked - theta order to find first one with at least
    % one neighbour ( over 7x7 neighbourhood )
    while ~ flag
        neighbourhood = [];
        for i = -3:3
            for j = -3:3
                if (i ~=0) || (j ~=0)
                    if available_estimates ( r( idx ( selected ))+ i , ...
                                             c( idx ( selected ))+ j)
                       neighbourhood = [ neighbourhood ;
                                         r( idx ( selected ))+ i c ( idx ( selected ))+ j ];
                    end
                end
            end
        end
        if ~ isempty ( neighbourhood )
            % We need at least one neighbour to test smoothness
            flag = true ;
        else
            selected = selected +1;
        end
    end
    % We now have a pixel with at least one neighbour
    r=r ( idx ( selected ));
    c=c ( idx ( selected ));
    % Select the normals from the neighbourhood
    Ns =[];
    for i =1: size ( neighbourhood ,1)
        Ns = [ Ns ;
            N( neighbourhood (i ,1) , neighbourhood (i ,2) ,1) ...
            N( neighbourhood (i ,1) , neighbourhood (i ,2) ,2) ...
            N( neighbourhood (i ,1) , neighbourhood (i ,2) ,3)];
    end
    % Compute which local solution has smaller mean angular deviation from
    % its neighbours , our definition of smoothness
    n1 = [ sin ( phi (r ,c ))* sin ( theta (r ,c ));
        cos ( phi (r , c ))* sin ( theta (r ,c ));
        cos ( theta (r ,c ))];
    n2 = [ sin ( phi (r ,c )+ pi )* sin ( theta (r , c ));
        cos ( phi (r , c )+ pi )* sin ( theta (r ,c ));
        cos ( theta (r ,c ))];
    % Select smoothest disambiguation and store chosen normal
    if mean ( acos ( Ns * n1 )) < mean ( acos ( Ns * n2 ))
        N(r ,c ,:)= n1 ;
    else
        N(r ,c ,:)= n2 ;
    end
    available_estimates (r ,c )= true ;
    idx ( selected )=[];
end










1 条回复


matbir 发表于 2021-11-25 21:19:56
报错信息发一下呀
您需要登录后才可以回帖 登录 | 注册

本版积分规则

相关帖子
相关文章
热门教程
站长推荐
快速回复 返回顶部 返回列表