inserting a picture with no background in GUI
Ältere Kommentare anzeigen
Hello, I am trying to insert an image in to my GUI. I created axes and imshow and when I run the GUI I can see the image. My problem is my image has no background (i don't want it to have a background) and when the code runs I get all black background and the image. Any ideas why GUI does that and how I can prevent it from happening?
I attached the image if that helps.
Thank you
1 Kommentar
Jan
am 3 Jan. 2016
Please explain, if the image is indexed or in true color.
Antworten (2)
Image Analyst
am 3 Jan. 2016
0 Stimmen
You didn't attach the image. An image must be rectangular. If MATLAB can take PNG files (which can have transparent pixels) and show you the figure background underneath the axes, then I don't know how to do that. Do you know for certain that you have transparent pixels and a PNG image? If you don't then there must be something in all areas of the image, so if not black, then what should it be? How are you displaying the image?
8 Kommentare
kyana shayan
am 11 Jan. 2016
Hi every one, I have the same problem with my PNG file. when I adjust the image to the axes, all I can see is black color for the background. My GUI has already have an image background, and I need this logo above all the figures. Please find attached my png file.
Image Analyst
am 11 Jan. 2016
It displays for me. Describe exactly what lines of code you're executing when you "adjust the image to the axes".
kyana shayan
am 11 Jan. 2016
axes(handles.axes3);
axis equal
I=imread('imageedit_1_2738085135.png');
imagesc(I)
kyana shayan
am 11 Jan. 2016
Bearbeitet: Image Analyst
am 11 Jan. 2016
Here is how it displays the png file in two different menus.


Image Analyst
am 11 Jan. 2016
Yes, I got that, but in gray scale because I used imshow() instead of imagesc() which applies some colormap automatically for some reason. So, what's the problem? Do you not like the colormap? What do you think the image should look like?
kyana shayan
am 11 Jan. 2016
Bearbeitet: Image Analyst
am 11 Jan. 2016
I want it with no background color. besides, I need those numbers gone. I want it like the attached picture.

Image Analyst
am 11 Jan. 2016
I'm not familiar with how or if transparent pixels work with PNG images, like if you can put an axes with a PNG image in it that has transparent pixels over another axes with a regular RGB image in it and have the underlying RGB pixels show through the transparent regions.
You could make a mask and then assign the non-transparent pixels to the RGB image to create a new RGB image with the images combined. Would that work for you?
kyana shayan
am 11 Jan. 2016
I don't know how to do that? can you be more specific?
Kategorien
Mehr zu Images finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!