Grayscale image displayed in weird colors in GUI
3 views (last 30 days)
Show older comments
Hi,
when I try to display a grayscale .jpg image in a GUI, the image is shown in weird colors:
This is what the image originally looks like:
I use a template for the GUI and display the image as follows:
imageName = 'table.jpg';
im_original= imread(imageName);
axes(handles.axes1);
image(im_original);
axis equal;
axis tight;
axis off;
If I display the image using imshow, it is shown correctly. Since the GUI-Part works for other images, I assume that the problem is that I edited the image beforehand. I used GIMP to transform the originally colored image to the grayscale one.
Do you have any idea how I can get the GUI to display the image normally?
Thanks, Chris
0 Comments
Answers (2)
Image Analyst
on 25 Jan 2016
Just use imshow() like you did. Walter gave the method to "fix" image (imagesc has the same "feature" but I didn't think image did). But I never use imagesc() or image(). imshow() is now in base MATLAB (no toolbox required) so just use that - it's better.
0 Comments
See Also
Categories
Find more on Display Image 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!