Radon transform of a circle. Error in imread function
3 views (last 30 days)
Show older comments
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?
0 Comments
Accepted Answer
Walter Roberson
on 21 Mar 2019
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.
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!