Matlab - ayudaaaaa

 
Vista:

ayudaaaaa

Publicado por slg (9 intervenciones) el 31/03/2008 11:02:41
Hola,

Llevo 1 semana intentando resolver un problema que parece que no existe. Tengo que cargar dos imagenes de archivo para mostrar por una GUI. El código que implemento es:

axes(handles.axes1);
imagen1 = imread('umbrales.jpg');
axis off;
imshow(imagen1);

axes(handles.axes2);
imagen2 = imread('constelaciones.jpg');
axis off;
imshow(imagen2);

No entiendo, donde puede estar el problema.

Gracias,
Saludos
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:ayudaaaaa

Publicado por Kike (304 intervenciones) el 31/03/2008 20:38:47
Bueno, en realidad no entiendo cómo funciona este código que encontré en un programa que bajé de MATLAB Central, pero lo he utilizado en una GUI y me funciona de maravilla.

axes(handles.axes1);
[I,map] = imread('antena','gif'); % la imagen se llama antena.gif
h1 = image(I);
set(handles.axes1,'Xtick',[ ]);
set(handles.axes1,'Ytick',[ ]);
colormap(map);
setappdata(0,'h',h1);
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:ayudaaaaa

Publicado por slg (9 intervenciones) el 31/03/2008 23:18:24
Gracias por tu ayuda

Saludos
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:ayudaaaaa

Publicado por Batman (15 intervenciones) el 01/04/2008 11:13:14
Hola
Si necesitas cargar imagenes y estas usando la GUI para hacer un interfaz te recomiendo que te bajes esta guia en pdf:
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=12122&objectType=FILE
escrita por Diego Barragan, es la mejor guia que he visto hasta ahora.

Te mando este trozo de codigo que carga 4 imagenes distintas, hecho con el guide.
Por si te sirve, esto funciona. Copialo al editor de matlab y ejecutalo.
Si quieres te mando el *.fig y el *.m

suerte

function varargout = CArgaImagenes(varargin)
% CARGAIMAGENES M-file for CArgaImagenes.fig
% CARGAIMAGENES, by itself, creates a new CARGAIMAGENES or raises the existing
% singleton*.
%
% H = CARGAIMAGENES returns the handle to a new CARGAIMAGENES or the handle to
% the existing singleton*.
%
% CARGAIMAGENES('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in CARGAIMAGENES.M with the given input arguments.
%
% CARGAIMAGENES('Property','Value',...) creates a new CARGAIMAGENES or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before CArgaImagenes_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to CArgaImagenes_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help CArgaImagenes

% Last Modified by GUIDE v2.5 11-Mar-2008 17:15:27

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @CArgaImagenes_OpeningFcn, ...
'gui_OutputFcn', @CArgaImagenes_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

% --- Executes just before CArgaImagenes is made visible.
function CArgaImagenes_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to CArgaImagenes (see VARARGIN)

axes(handles.axes1)
background = imread('nuclear1.jpg');
axis off;
imshow(background);
%*-*-*-*-*-*-*-*-*-*-*-*-

axes(handles.axes2)
background = imread('nuclear2.jpg');
axis off;
imshow(background);
%*-*-*-*-*-*-*-*-*-*-*-*-*-*

axes(handles.axes3)
background = imread('nuclear3.jpg');
axis off;
imshow(background);
%*-*-*-*-*-*-*-*-*-*-*-*-*-*

axes(handles.axes4)
background = imread('nuclear4.jpg');
axis off;
imshow(background);


% Choose default command line output for CArgaImagenes
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes CArgaImagenes wait for user response (see UIRESUME)
% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = CArgaImagenes_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar