Background image in standalone GUI

1 Ansicht (letzte 30 Tage)
ANUBHAV SINHA
ANUBHAV SINHA am 10 Dez. 2011
I am constructing a standalone GUI exe. The GUI has a image in its background. I use the command 'imshow(folder path of image)' to display the image within a axes graphic obect....example.. axes(handles.Photo_name); imshow('C:\Users\XYZ\Desktop\Photo_name.PNG')
However, when I package it as a standalone windows exe, the image is not displayed if I run it on another computer that doesnot have MATLAB.
Kindly guide about how this problem be solved. I want this GUI exe to be accessed by anyone across the world without the need of MATLAB.

Antworten (2)

Image Analyst
Image Analyst am 10 Dez. 2011
Are you sure that image is located in that EXACT path that you hard coded in there on your target computer? My guess is no. Did you check the console window for any error messages that you printed out? You DID use try/catch and exist(filename, 'file') for robustness, didn't you? (Again, I'd guess no.) So you should see a warning in the console window when/if your code failed to find the file, or any other error that may have occurred.

ANUBHAV SINHA
ANUBHAV SINHA am 10 Dez. 2011
I think you are suggesting me to provide the target user with the image file and store it at the same location(ie..EXACT path as in hardcode) as mentioned in the code.
If yes, then the GUI exe is no more a 'stand-alone'!! I intend to construct GUI exe which can be accessed by user without bothering to install/download anything else except the MCR.
Kindly suggest any method to do so. How can I literally 'embed' the image in the exe itself and make the display of image 'path independent'? Any alternative to 'imshow' to do this?
  1 Kommentar
Image Analyst
Image Analyst am 11 Dez. 2011
Use the -a option to bundle other files into your installer. You can include .mat files, image files, data files, Excel templates, user manuals, etc. You still would have just one installer (.exe). To make the file path independent you'd have to use ctfroot and fullfile() and exist().

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by