radial_sum.m

来自「图像重建中投影建模算法对二维图像进行投影值计算的程序」· M 代码 · 共 44 行

M
44
字号
function s=radial_sum(photo_matrix,r,theta)
    weishu=size(photo_matrix);
    if theta>=360
        theta=theta-360;
    end;
    if theta<0
        theta=360+theta;
    end;
    if theta>180&theta<360
        theta=theta-180;r=-r;
    end;
    N=weishu(1);
       if 0<=theta&theta<=45 
            theta0=theta;flag=1;
        elseif 45<=theta&theta<=90
            theta0=90-theta;flag=2;
        elseif 90<=theta&theta<=135
            theta0=theta-90;flag=3;
        elseif  135<=theta&theta<=180
            theta0=180-theta;flag=4;
        else  
            flag=0;
        end;
        
        switch flag
            case 0 
                error('the theta is out of range!');
            case 1
               cover_matrix=radial_cover(N,r,theta0);
            case 2
                cover=radial_cover(N,-r,theta0);
                cover_matrix=cover';
            case 3
                cover=radial_cover(N,r,theta0);
                cover_matrix=flipud(cover');
            case 4
                cover=radial_cover(N,r,theta0);
                cover_matrix=fliplr(cover);
         end;
   
   %covered=photo_matrix.*cover_matrix;
   s=sum(photo_matrix(cover_matrix>0));
      
       

⌨️ 快捷键说明

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