Matlab - Superponer imagen y grafico.

 
Vista:

Superponer imagen y grafico.

Publicado por Jose Acuña (11 intervenciones) el 24/01/2013 18:58:51
Consulta..


Quería saber si es posible superponer una imagen.jpg y un gráfico cualquiera.?


Por ejemplo, ya tengo tengo un GUI donde tengo un axes1 con una imagen.jpg y un axes 2 con un gráfico generado por una función tipo sen(x), quería saber si es posible dejar el axe1 inmóvil como referencia y suporponer el axes2.

La idea es poder hacer una comparativa entre la imagen y la función.

Gracias.

function varargout = untitled(varargin)

gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @untitled_OpeningFcn, ...
'gui_OutputFcn', @untitled_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 untitled is made visible.
function untitled_OpeningFcn(hObject, eventdata, handles, varargin)
a=imread('sunde.jpg');
image(a)
axis off
hold
% 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 untitled (see VARARGIN)

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

% Update handles structure
guidata(hObject, handles);

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


% --- Outputs from this function are returned to the command line.
function varargout = untitled_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;




% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

axes(handles.axes1)
x=linspace(-2*pi,2*pi);
plot(x,sin(x));
grid




function edit2_Callback(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit2 as text
% str2double(get(hObject,'String')) returns contents of edit2 as a double


% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
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
Imágen de perfil de JOSE JEREMIAS CABALLERO
Val: 6.975
Oro
Ha mantenido su posición en Matlab (en relación al último mes)
Gráfica de Matlab

Superponer imagen y grafico.

Publicado por JOSE JEREMIAS CABALLERO (5917 intervenciones) el 24/01/2013 21:22:06
Directamente no creo que se pueda, pero si tu imagen de sin(x) lo guardas con extensión de *.jpg y luego llamas si se puede. Pero ya es un tema mas avanzado lo que quieres hacer.


Saludos.
JOSE JEREMIAS CABALLERO
Asesor de Proyectos con Matlab
programador en matlab
Servicios de programación matlab
[email protected]

http://matlabcaballero.blogspot.com
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

Superponer imagen y grafico.

Publicado por Jose Acuña (11 intervenciones) el 24/01/2013 22:54:01
Si, entiendo su idea...y creo que es un problema muy complejo de solucionar.

Gracias
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

Superponer imagen y grafico.

Publicado por Jose Acuña (11 intervenciones) el 31/01/2013 07:10:19
Buenos días.

Solo quería comentar que ya encontré la solución a mi problema.

Para lograr superponer gráficos se utilizan los siguientes comando:

Para el gráfico que va de base se le agrega el comando axis(axis).

El gráfico que se va superponer, se le agrega el comando "axis off"

Ahora, en el gui se superponen los axes a gusto.
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
Imágen de perfil de JOSE JEREMIAS CABALLERO
Val: 6.975
Oro
Ha mantenido su posición en Matlab (en relación al último mes)
Gráfica de Matlab

Superponer imagen y grafico.

Publicado por JOSE JEREMIAS CABALLERO (5917 intervenciones) el 31/01/2013 14:35:49
gracias por compartir.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function varargout = superponer_imagen_grafico(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @superponer_imagen_grafico_OpeningFcn, ...
                   'gui_OutputFcn',  @superponer_imagen_grafico_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
function superponer_imagen_grafico_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
guidata(hObject, handles);
 
function varargout = superponer_imagen_grafico_OutputFcn(hObject, eventdata, handles)
varargout{1} = handles.output;
 
function abrir_imagen_Callback(hObject, eventdata, handles)
[FileName, Path]=uigetfile({'*.jpg;*.bmp;*.png'},'Abrir Imagen');
axes(handles.axes1);
if isequal(FileName,0)
    return
else
   foto=imread([Path,FileName]);
    imshow(foto);
    handles.foto=foto;
end
guidata(hObject,handles)
axes(handles.axes6);
x=linspace(-pi,pi);
plot(x,sin(x))
axis off



Saludos.
JOSE JEREMÍAS CABALLERO
Asesorías en Matlab
programador en matlab
Servicios de programación matlab
[email protected]

http://matlabcaballero.blogspot.com
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
Imágen de perfil de JOSE JEREMIAS CABALLERO
Val: 6.975
Oro
Ha mantenido su posición en Matlab (en relación al último mes)
Gráfica de Matlab

Superponer imagen y grafico.

Publicado por JOSE JEREMIAS CABALLERO (5917 intervenciones) el 31/01/2013 15:41:30
Gracias por tu aporte JOSE acuña al foro de MATLAB.

Si todo los usuarios que hacen sus preguntas, si en ocaciones no se les contesta por x motivos, y si ellos mismos encuentran la respuesta, y dieran respuestas a sus propias preguntas en el foro.
Casi toda las preguntas del foro estarían estarían con sus respuestas.
Y seria de mucho ayuda para los demás usuarios de matlab que tengan dudas en los mismos puntos.



Saludos.
JOSE JEREMÍAS CABALLERO
Asesorías en Matlab
programador en matlab
Servicios de programación matlab
[email protected]

http://matlabcaballero.blogspot.com
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