[問題] 要怎麼全螢幕執行啊已回收
請問一下 要怎麼讓gui全螢幕執行啊
%GUI for pair comparison image experiment
function varargout = pair_comp_test(varargin)
% PAIR_COMP_TEST M-file for pair_comp_test.fig
% Last Modified by GUIDE v2.5 30-Sep-2008 00:01:34
% Written by P.L. Sun
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @pair_comp_test_OpeningFcn, ...
'gui_OutputFcn', @pair_comp_test_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 pair_comp_test is made visible.
function pair_comp_test_OpeningFcn(hObject, eventdata, handles, varargin)
clc, warning off
set([handles.axes1 handles.axes2 handles.betterBtn1 handles.betterBtn2
handles.undoBtn], 'visible', 'off')
axes(handles.axes3)
imshow(imread('pairCompInstruction.tif'))
if exist('pairCompData.mat') == 0
maxObsNo = 30;
score3 = logical(zeros(3,3,maxObsNo));
score4 = logical(zeros(4,4,maxObsNo));
score5 = logical(zeros(5,5,maxObsNo));
score6 = logical(zeros(6,6,maxObsNo));
score7 = logical(zeros(7,7,maxObsNo));
score8 = logical(zeros(8,8,maxObsNo));
score9 = logical(zeros(9,9,maxObsNo));
score10 = logical(zeros(10,10,maxObsNo));
save pairCompData.mat score3 score4 score5 score6 score7 score8 score9
score10
end
handles.output = hObject;
guidata(hObject, handles);
% --- Outputs from this function are returned to the command line.
function varargout = pair_comp_test_OutputFcn(hObject, eventdata, handles)
varargout{1} = handles.output;
function edit1_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'));
set(hObject,'BackgroundColor','white');end
function edit2_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');end
% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');end
% --- Executes on button press in StartBtn.
function StartBtn_Callback(hObject, eventdata, handles)
handles.obsNo = str2num(get(handles.edit1, 'string'));
handles.imgNo = str2num(get(handles.edit2, 'string'));
n=0;
for x=1:handles.imgNo-1
for y=x+1:handles.imgNo
n=n+1;
handles.orgSequence(n,1) = x;
handles.orgSequence(n,2) = y;
end
end
handles.totalPairs = n;
handles.a = randperm(n);
handles.scoreObs = zeros(handles.imgNo);
bk = get(handles.popupmenu1, 'value');
set(gcf,'color',[(bk-1)/2 (bk-1)/2 (bk-1)/2])
axes(handles.axes3)
bkImg = ones(1,1,3);
bkImg(1,1,:) = (bk-1)/2*255;
imshow(uint8(bkImg))
set([handles.text1 handles.text2 handles.edit1 handles.edit2
handles.popupmenu1 handles.StartBtn], 'visible', 'off')
set([handles.axes1 handles.axes2 handles.betterBtn1 handles.betterBtn2
handles.undoBtn], 'visible', 'on')
handles.seq = 1;
guidata(hObject, handles);
showImagePair_Callback(hObject, handles)
% --- Executes on button press in betterBtn1.
function betterBtn1_Callback(hObject, eventdata, handles)
%save current data
fprintf(' L\n')
handles.scoreObs(handles.imgID2, handles.imgID1) = 1;
%show next image pair
if handles.seq < handles.totalPairs
handles.seq = handles.seq + 1;
guidata(hObject, handles);
showImagePair_Callback(hObject, handles)
else
saveData_Callback(hObject, handles)
end
% --- Executes on button press in betterBtn2.
function betterBtn2_Callback(hObject, eventdata, handles)
%save current data
fprintf(' R\n')
handles.scoreObs(handles.imgID1, handles.imgID2) = 1;
%show next image pair
if handles.seq < handles.totalPairs
handles.seq = handles.seq + 1;
guidata(hObject, handles);
showImagePair_Callback(hObject, handles)
else
saveData_Callback(hObject, handles)
end
% --- Executes on button press in undoBtn.
function undoBtn_Callback(hObject, eventdata, handles)
handles.seq = handles.seq - 1;
if handles.seq < 1; handles.seq = 1; end
guidata(hObject, handles);
fprintf(' Undo\n')
showImagePair_Callback(hObject, handles)
% --- Sub-function for betterBtn1, betterBtn2 and undoBtn.
function showImagePair_Callback(hObject, handles)
k = handles.a(handles.seq);
if rand()>0.5
handles.imgID1 = handles.orgSequence(k,1);
handles.imgID2 = handles.orgSequence(k,2);
else
handles.imgID1 = handles.orgSequence(k,2);
handles.imgID2 = handles.orgSequence(k,1);
end
guidata(hObject, handles);
fprintf('[%d] %d vs. %d ', handles.seq, handles.imgID1, handles.imgID2)
axes(handles.axes1)
imshow([int2str(handles.imgID1) '.jpg'])
axes(handles.axes2)
imshow([int2str(handles.imgID2) '.jpg'])
% --- Sub-function for betterBtn1 and betterBtn2.
function saveData_Callback(hObject, handles)
load pairCompData
scoreObs = handles.scoreObs;
fprintf('\n')
disp('this observer:')
disp(scoreObs)
switch handles.imgNo
case 3
score3(:,:,handles.obsNo) = scoreObs; newScore = score3;
case 4
score4(:,:,handles.obsNo) = scoreObs; newScore = score4;
case 5
score5(:,:,handles.obsNo) = scoreObs; newScore = score5;
case 6
score6(:,:,handles.obsNo) = scoreObs; newScore = score6;
case 7
score7(:,:,handles.obsNo) = scoreObs; newScore = score7;
case 8
score8(:,:,handles.obsNo) = scoreObs; newScore = score8;
case 9
score9(:,:,handles.obsNo) = scoreObs; newScore = score9;
case 10
score10(:,:,handles.obsNo) = scoreObs; newScore = score10;
end
save pairCompData.mat score3 score4 score5 score6 score7 score8 score9
score10 -append
msgbox({'Thank you for your contribution.';'See "pairCompData.mat"';'for the
data'},'Complete!','help')
uiwait
close
M=sum(newScore, 3);
disp('all observers:')
disp(M)
figure
paircomp_data(M);
xlabel('images'), ylabel('z-score'), set(gcf,'color','w')
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 124.8.196.30
→
10/01 22:30, , 1F
10/01 22:30, 1F
MATLAB 近期熱門文章
PTT數位生活區 即時熱門文章