How do you add an image to a plot?
7 views (last 30 days)
Show older comments
In class we were told to add images to our plot and they gave us an example that worked like this:
url = 'http://www.inpayne.com/models/350e1.jpg';
img = imread(url);
himg = image([200,250],[200,250],img);
Only every time I use this on my plot I get the error message: "Attempt to call constructor image with incorrect letter case."
Does anyone know what could be causing this error? Thank you!
2 Comments
Geoff Hayes
on 4 May 2014
The error that you are observing is similar to that found with imshow at the following link: error in imshow. There may be a conflict with an existing variable or folder named image which would require you to rename the variable or folder. If you type which image -all in the command window, what is returned? (The which command will return all variables and functions that have the image name.)
Answers (2)
Jan
on 4 May 2014
Edited: Jan
on 4 May 2014
Check, which command or class is called:
which image -all
which Image -all
What do you get as output?
[EDITED - this is wrong:] I guess, that if you do not have the Image Processing Toolbox, but a user defined class called "Image", such a problem could appear. [ image does not belong to the Image Processing Toolbox!]
0 Comments
Image Analyst
on 5 May 2014
Here's what it says on my system (where your code works):
>> which -all image
built-in (C:\Program Files\MATLAB\R2014a\toolbox\matlab\specgraph\image)
Here's what it says on your system:
>> which -all image
C:\Users\Nicole\Documents\MATLAB\image.m
built-in (C:\Program Files\MATLAB\R2013b\toolbox\matlab\specgraph\image)
Note that you have an extra file. Take this file "C:\Users\Nicole\Documents\MATLAB\image.m", which is apparently something you wrote, and rename it.
0 Comments
See Also
Categories
Find more on Image Processing Toolbox 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!