please , i have this code of gui matlab and i would to genrate the countour of my figure without run through the path way of mu image

function varargout = pfe1(varargin)
% PFE1 MATLAB code for pfe1.fig
% PFE1, by itself, creates a new PFE1 or raises the existing
% singleton*.
%
% H = PFE1 returns the handle to a new PFE1 or the handle to
% the existing singleton*.
%
% PFE1('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in PFE1.M with the given input arguments.
%
% PFE1('Property','Value',...) creates a new PFE1 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before pfe1_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to pfe1_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 pfe1
% Last Modified by GUIDE v2.5 11-May-2013 13:22:54
% Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @pfe1_OpeningFcn, ... 'gui_OutputFcn', @pfe1_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 pfe1 is made visible. function pfe1_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 pfe1 (see VARARGIN)
% Choose default command line output for pfe1 handles.output = hObject;
% Update handles structure guidata(hObject, handles);
% UIWAIT makes pfe1 wait for user response (see UIRESUME) % uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line. function varargout = pfe1_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 parcourir_im1. function parcourir_im1_Callback(hObject, eventdata, handles) % hObject handle to parcourir_im1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) axes(handles.uigetfile) nomfichier=[]; [filename,pathname] = uigetfile({'*.jpg';'*.png';'*.bmp'},'Choisissez une image'); % Choisir une image chemin=[pathname filename] if isequal(filename,0) disp('Image non acquise') else disp(['Image acquise ', fullfile(filename,pathname)]) end M=imread(filename); imshow(M);% Afficher l'image title('Image originalle'); axis on; handles.ImgPret=M; guidata(hObject,handles)
% --- Executes on button press in contour_im1. function contour_im1_Callback(hObject, eventdata, handles) % hObject handle to contour_im1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) axes(handles.uigetfile2) nomfichier=[]; [filename,pathname] = uigetfile({'*.'},'Choisissez une image'); % Choisir une image chemin=[pathname filename] if isequal(filename,0) disp('Image non acquise') else disp(['Image acquise ', fullfile(filename,pathname)]) end I=imread(filename); BW = im2bw(I); se=strel('rectangle',[2 20]); BW1=imopen(BW,se); dim = size(BW1) col = round(dim(2)/2)-90; row = min(find(BW1(:,col))); boundary = bwtraceboundary(BW1,[row, col],'E'); imshow(I) hold on; plot(boundary(:,2),boundary(:,1),'r','LineWidth',1.5); BW_filled = imfill(BW1,'holes'); boundaries = bwboundaries(BW_filled); for k=1:1 b = boundaries{k}; plot(b(:,2),b(:,1),'g','LineWidth',1.5); end handles.ImgPret=I; guidata(hObject,handles)

Answers (0)

Categories

Tags

Asked:

on 13 May 2013

Community Treasure Hunt

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

Start Hunting!