Not enough input arguments in rgb2gray function
Show older comments
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 Comments
Stephen23
on 9 May 2017
@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
on 9 May 2017
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB Code Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!