Radon transform of a circle. Error in imread function

2 ビュー (過去 30 日間)
Kim Y
Kim Y 2019 年 3 月 21 日
回答済み: Walter Roberson 2019 年 3 月 21 日
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?

採用された回答

Walter Roberson
Walter Roberson 2019 年 3 月 21 日
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 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by