why does it give the error undefined function?
Show older comments
Hi all,
I have written this code but when I run the code it gives the error
"Undefined function or variable imageX"
It is not my first time writing a code and I have other codes working properly except this one. Could someone help me figure out the problem?
here is the code I wrote:
function imageOut = imageX(imageIn,object);
jpgImage = imread(imageIn);
spaceRow = size(object,1)-size(jpgImage,1);
spaceAbove = round(spaceRow/2);
spaceBelow = spaceRow - spaceAbove;
jpgImage1 = [255.*ones(spaceAbove,size(jpgImage,2),size(jpgImage,3));jpgImage;255.*ones(spaceBelow,size(jpgImage,2),size(jpgImage,3))];
spaceColumn = size(object,2)-size(jpgImage,2);
spaceRight = round(spaceColumn/2);
spaceLeft = spaceColumn - spaceRight;
imageOut = [255.*ones(size(jpgImage1,1),spaceLeft,size(jpgImage,3)),jpgImage1,255.*ones(size(jpgImage1,1),spaceRight,size(jpgImage,3))];
imwrite(imageOut,'imageOut.jpg');
end
3 Comments
Walter Roberson
on 25 Dec 2017
You have not stored the code in imageX.m or the file is not on your MATLAB path.
Image Analyst
on 25 Dec 2017
To put 255 around your image, why not use padarray()?
Walter Roberson
on 25 Dec 2017
K.G. comments to Image Analyst:
thanks I did not know about this function
Accepted Answer
More Answers (0)
Categories
Find more on Image Processing and Computer Vision 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!