function varargout = tupian(varargin)
% TUPIAN M-file for tupian.fig
% TUPIAN, by itself, creates a new TUPIAN or raises the existing
% singleton*.
%
% H = TUPIAN returns the handle to a new TUPIAN or the handle to
% the existing singleton*.
%
% TUPIAN('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in TUPIAN.M with the given input arguments.
%
% TUPIAN('Property','Value',...) creates a new TUPIAN or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before tupian_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to tupian_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 tupian
% Last Modified by GUIDE v2.5 26-Dec-2012 08:35:41
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @tupian_OpeningFcn, ...
'gui_OutputFcn', @tupian_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 tupian is made visible.
function tupian_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 tupian (see VARARGIN)
% Choose default command line output for tupian
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes tupian wait for user response (see UIRESUME)
% uiwait(handles.f_tupian);
% --- Outputs from this function are returned to the command line.
function varargout = tupian_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 b_left.
function b_left_Callback(hObject, eventdata, handles)
% hObject handle to b_left (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%% ---------------------------------------------------------------
points = [];
pointNum = 0;
% we want to show all points on the same fig
hold on;
% 1,2,3 means left, middle, right mouse button is clicked
button = 1;
while(button ~= 3) % user use right click to input the last point
% use ginput to get graphical input from mouse
[x, y, button] = ginput(1); % plot the point
plot(x,y,'bo'); % save
pointNum = pointNum + 1;
points(pointNum, :) = [x y];
end
points
%% ---------------------------------------------------------------
% --- Executes on button press in b_mid.
function b_mid_Callback(hObject, eventdata, handles)
% hObject handle to b_mid (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%% ---------------------------------------------------------------
points = [];
pointNum = 0;
% we want to show all points on the same fig
hold on;
% 1,2,3 means left, middle, right mouse button is clicked
button = 1;
while(button ~= 3) % user use right click to input the last point
% use ginput to get graphical input from mouse
[x, y, button] = ginput(1); % plot the point
plot(x,y,'ro'); % save
pointNum = pointNum + 1;
points(pointNum, :) = [x y];
end
points
%% ---------------------------------------------------------------
% --- Executes on button press in b_right.
function b_right_Callback(hObject, eventdata, handles)
% hObject handle to b_right (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%% ---------------------------------------------------------------
points = [];
pointNum = 0;
% we want to show all points on the same fig
hold on;
% 1,2,3 means left, middle, right mouse button is clicked
button = 1;
while(button ~= 3) % user use right click to input the last point
% use ginput to get graphical input from mouse
[x, y, button] = ginput(1); % plot the point
plot(x,y,'yo'); % save
pointNum = pointNum + 1;
points(pointNum, :) = [x y];
end
points
%% ---------------------------------------------------------------
% --- Executes on button press in b_select.
function b_select_Callback(hObject, eventdata, handles)
% hObject handle to b_select (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in b_delete.
function b_delete_Callback(hObject, eventdata, handles)
% hObject handle to b_delete (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function t_open_ClickedCallback(hObject, eventdata, handles)
% hObject handle to t_open (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[filename, pathname] = uigetfile(...
{'*.bmp;*.jpg;*.png;*.jpeg', 'Image Files (*.bmp, *.jpg, *.png, *.jpeg)'; ...
'*.*', 'All Files (*.*)'},...
'Pick an image');
if isequal(filename,0) || isequal(pathname,0),
return;
end
% axes(handles.a_figure); %用axes命令设定当前操作的坐标轴是axes_src
fpath=[pathname filename];%将文件名和目录名组合成一个完整的路径
img_tupian=imread(fpath);
imshow(img_tupian);;%用imread读入图片,并用imshow在axes_src上显示
setappdata(handles.f_tupian,'img_tupian',img_tupian);
评论0