Not enough input arguments in rgb2gray function
显示 更早的评论
Hi, i´m a newbie in matlab. I´m tring to get a cilindrical projection of a planar image. The code is with this error "Error using projectIC (line 8) Not enough input arguments. ". I´m making some mistake inserting the image input, I1 (matrix), on the rgb2gray function I suppose. Can you help me? Thank you the code is the following:
% I1=imread('i1.bmp');
imshow(I1)
angle=33;
%
function [imageC] = projectIC(I1,angle)
ig = rgb2gray(I1);
[h w] = size(ig);
imageC = uint8(zeros(h,w));
alpha = angle/180*pi;
d = (w/2)/tan(alpha);
r = d/cos(alpha);
for x = -w/2+1:w/2
for y = -h/2+1:h/2
x1 = d * tan(x/r);
y1 = y * (d/r) /cos(x/r);
if x1 < w/2 && x1 > -w/2+1 && y1 < h/2 && y1 > -h/2+1
imageC(y+(h/2), x+(w/2) ) = ig(round(y1+(h/2)),round(x1+(w/2)));
end
end
end
2 个评论
Stephen23
2017-5-9
@João Martinho Marques: do NOT attach code as an image. We cannot search for text in an image, we cannot edit an image, we cannot run an image, we cannot fix an image... if you have code then it is text, so please either include it in your question as text or upload it as a text file.
João Martinho Marques
2017-5-9
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB Code Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!