| 
|  
|  | 
| 
 
 
	
		|  | 2 axes, 2 verschiedene bilder bearbeiten |  |  
 
| 
| docschoco |  
|  
 Forum-Newbie
 
 
 
|  |  
|  | Beiträge: 1 |  |  
|  |  
|  | Anmeldedatum: 27.12.12 |  |  
|  |  
|  | Wohnort: --- |  |  
|  |  
|  | Version: R2011a |  |  
|  |  |  
|  |  | 
|  Verfasst am: 27.12.2012, 21:09    
Titel: 2 axes, 2 verschiedene bilder bearbeiten |  |  
|  |  |   |  
| Hallo zusammen, ich möchte ein GUI programmieren, welches ein Originalbild und ein transformiertes Bild anzeigt.
 
 Der Fehler:
 Wenn der Button z.B. FarbtrafoJET gedrückt wird, ändert sich auch das Originalbild. Das Originalbild soll weiterhin unverändert im axes1 Objekt angezeigt werden. Daneben soll das transformierte Bild im axes2 Objekt angezeigt werden.
 
 Ich habe mir schon mehrere Forenbeiträge durchgelesen und 3 Bücher ausgeliehen und zumindestens eines "Programmieren mit Matlab" gelesen. Dieses ist allerdings eher für Einsteiger gedacht.
 
 Code und Screenshots im Anhang
 
 function varargout = untitled(varargin)
 % UNTITLED MATLAB code for untitled.fig
 %      UNTITLED, by itself, creates a new UNTITLED or raises the existing
 %      singleton*.
 %
 %      H = UNTITLED returns the handle to a new UNTITLED or the handle to
 %      the existing singleton*.
 %
 %      UNTITLED('CALLBACK',hObject,eventData,handles,...) calls the local
 %      function named CALLBACK in UNTITLED.M with the given input arguments.
 %
 %      UNTITLED('Property','Value',...) creates a new UNTITLED or raises the
 %      existing singleton*.  Starting from the left, property value pairs are
 %      applied to the GUI before untitled_OpeningFcn gets called.  An
 %      unrecognized property name or invalid value makes property application
 %      stop.  All inputs are passed to untitled_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 untitled
 
 % Last Modified by GUIDE v2.5 26-Dec-2012 17:46:04
 
 % Begin initialization code - DO NOT EDIT
 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)
 % 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)
 
 dateiName = uigetfile({'*.jpg;*.tif;*.png;*.gif','All Image Files';...
 '*.*','All Files' },'Datei öffnen',...
 'C:\');
 
 if (isequal(dateiName, 0))
 disp('Benutzer wählte Cancel')
 return; % cancel
 else
 originalBild = imread(dateiName);
 assignin('base', 'originalBild', originalBild);
 axes(handles.axes1);
 %figure;
 image(originalBild);
 colormap(gray(255));
 end
 
 % --- Executes on button press in pushbutton2.
 function pushbutton2_Callback(hObject, eventdata, handles)
 % hObject    handle to pushbutton2 (see GCBO)
 % eventdata  reserved - to be defined in a future version of MATLAB
 % handles    structure with handles and user data (see GUIDATA)
 bild2ColormapJET = evalin('base', 'originalBild');
 axes(handles.axes2);
 %figure;
 image(bild2ColormapJET);
 colormap(jet(255));
 
 
 
 
 % --- Executes during object creation, after setting all properties.
 function axes1_CreateFcn(hObject, eventdata, handles)
 % hObject    handle to axes1 (see GCBO)
 % eventdata  reserved - to be defined in a future version of MATLAB
 % handles    empty - handles not created until after all CreateFcns called
 
 % Hint: place code in OpeningFcn to populate axes1
 
 
 % --- Executes on button press in pushbutton3.
 function pushbutton3_Callback(hObject, eventdata, handles)
 % hObject    handle to pushbutton3 (see GCBO)
 % eventdata  reserved - to be defined in a future version of MATLAB
 % handles    structure with handles and user data (see GUIDATA)
 bild2ColormapHOT = evalin('base', 'originalBild');
 axes(handles.axes2);
 %figure;
 image(bild2ColormapHOT);
 colormap(hot(255));
 
 
 % --- Executes when user attempts to close figure1.
 function figure1_CloseRequestFcn(hObject, eventdata, handles)
 % hObject    handle to figure1 (see GCBO)
 % eventdata  reserved - to be defined in a future version of MATLAB
 % handles    structure with handles and user data (see GUIDATA)
 
 % Hint: delete(hObject) closes the figure
 delete(hObject);
 
 
 
	
		
	 
		| Beschreibung: |  |  Download
 |  
		| Dateiname: | untitled.m |  
		| Dateigröße: | 4.92 KB |  
		| Heruntergeladen: | 373 mal |  
	
		
	 
		| Beschreibung: | 
			
				| 2 Schritt, Bild transformieren, fehlerhaft, originalbild wird auch bearbeitet |  |  Download
 |  
		| Dateiname: | 2 Bild transformieren FHLERHAFT.jpg |  
		| Dateigröße: | 93.08 KB |  
		| Heruntergeladen: | 515 mal |  
	
		
	 
		| Beschreibung: |  |  Download
 |  
		| Dateiname: | 1 Bild laden.jpg |  
		| Dateigröße: | 69.44 KB |  
		| Heruntergeladen: | 562 mal |  |  |  
|  |  |  
		| 
 
 |  
| 
| Jan S |  
|  
 Moderator
 
 
 
|  |  
|  | Beiträge: 11.057 |  |  
|  |  
|  | Anmeldedatum: 08.07.10 |  |  
|  |  
|  | Wohnort: Heidelberg |  |  
|  |  
|  | Version: 2009a, 2016b |  |  
|  |  |  
|  |  | 
|  Verfasst am: 28.12.2012, 02:45    
Titel: Re: 2 axes, 2 verschiedene bilder bearbeiten |  |  
| Hallo docschoco, 
 Bitte verwende die Code-Umgebung für Sourcecode. Danke!
 
 Der gepostete Code ist ziemlich groß. Es wäre nicht effizient, wenn wir ihn nun durchsuchen, weil Du ja weißt, wo was geschehen soll. Dann wäre es doch naheliegend, Du setzt ein paar Breakpoints in den Code und findest die Zeile, die das unerwünschte Verhalten produziert. Dann kannst Du das Problem entweder bereits selbst lösen, oder genau diese Zeile posten und nochmal im Forum nachfragen.
 
 Bücher und Foren sind schon toll, der Debugger ist aber im Allgemeinen kraftvoller, weil ihm Orginal-Daten und das Wissen des Autors zur Seite stehen.
 
 Gruß, Jan
 |  |  
|  |  
|     
 
 | 
 
 |  
| Einstellungen und Berechtigungen |  
| 
 | Du kannst Beiträge in dieses Forum schreiben. Du kannst auf Beiträge in diesem Forum antworten.
 Du kannst deine Beiträge in diesem Forum nicht bearbeiten.
 Du kannst deine Beiträge in diesem Forum nicht löschen.
 Du kannst an Umfragen in diesem Forum nicht mitmachen.
 Du kannst Dateien in diesem Forum posten
 Du kannst Dateien in diesem Forum herunterladen
 
 |  |  
 Impressum
 | Nutzungsbedingungen
 | Datenschutz
 | FAQ
 |
  RSS 
 Hosted by:
 
   
 Copyright © 2007 - 2025
goMatlab.de | Dies ist keine offizielle Website der Firma The Mathworks
 
 MATLAB, Simulink, Stateflow, Handle Graphics, Real-Time Workshop, SimBiology, SimHydraulics, SimEvents, and xPC TargetBox are registered trademarks and The MathWorks, the L-shaped membrane logo, and Embedded MATLAB are trademarks of The MathWorks, Inc.
 
 
 |  |