如何在不使用Radon的情况下获得图像投影

时间:2013-10-01 15:10:55

标签: matlab

我需要对图像进行Radon变换,但我不允许使用MATLAB的Radon函数。所以我必须自己编写。

我已经做了一些研究,但找不到任何令人满意的例子。

  • 有没有其他方法可以获取图像的投影 使用氡?
  • 如果没有,我怎么能写自己的氡功能(至少一点点 线索)

2 个答案:

答案 0 :(得分:1)

氡变换将2D /伪3D图像转换为1D强度等效物。基本上,我们计算所有角度θ的一行像素的所有强度之和。

Justin K. Romberg(莱斯大学)在https://www.clear.rice.edu/elec431/projects96/DSP/projections.html

上的原始代码

projections.m

%%This MATLAB function takes an image matrix and vector of angles and
%%then finds the 1D projection (Radon transform) at each of the angles.
%%It returns a matrix whose columns are the projections at each angle.
%% Written by : Justin K. Romberg

function PR = projections(IMG, THETA)

% pad the image with zeros so we don't lose anything when we rotate.
[iLength, iWidth] = size(IMG);
iDiag = sqrt(iLength^2 + iWidth^2);
LengthPad = ceil(iDiag - iLength) + 2;
WidthPad = ceil(iDiag - iWidth) + 2;
padIMG = zeros(iLength+LengthPad, iWidth+WidthPad);
padIMG(ceil(LengthPad/2):(ceil(LengthPad/2)+iLength-1), ...
    ceil(WidthPad/2):(ceil(WidthPad/2)+iWidth-1)) = IMG;
% loop over the number of angles, rotate 90-theta (because we can easily sum
% if we look at stuff from the top), and then add up.  Don't perform any
% interpolation on the rotating.
n = length(THETA);
PR = zeros(size(padIMG,2), n);
for i = 1:n
   tic
   tmpimg = imrotate(padIMG, 90-THETA(i), 'bilinear', 'crop');
   PR(:,i) = (sum(tmpimg))';
   THETA(i)
   toc
end

答案 1 :(得分:0)

我不知道你搜索的是什么,但看看: Matlab code at the end.