MATLAB: Radon transform of a circle. Error in imread function

imreadradon transform

Hi everyone,
This is my code to radon transform a circle:
A = imread('circ3.png');
theta = 0:180;
[R,xp] = radon(A,theta);
imshow(R,[],'Xdata',theta,'Ydata',xp,'InitialMagnification','fit')
xlabel('\theta (degrees)')
ylabel('x''')
colormap(gca,hot), colorbar
However I am getting this error when I run my code:
Error in radon (line 63)
validateattributes(I,{'numeric','logical'},{'2d','nonsparse'},mfilename,'I',1);
Error in Untitled9 (line 3)
[R,xp] = radon(A,theta);
The image circ3.png is saved on my PC and imshow(A) works perfectly fine. I also tried the code with A=imread('circlesbrightdark.png.') and the code runs fine. But the image circlesbrightdark.png isnt saved on my PC? So where is the code reading the image from?

Best Answer

You cannot apply radon() to an RGB image. Look at ndims(A) to see whether it is 2 (2D) or 3 (RGB or RGBA)
Note that some RGB images look grayscale, because they happen to have equal R G and B.
Related Question