Cannot call or index into a temporary array....below is my code..

2 ビュー (過去 30 日間)
Ali Khan
Ali Khan 2017 年 7 月 11 日
編集済み: KSSV 2017 年 7 月 11 日
function varargout = PoseEstimator(varargin)
% POSEESTIMATOR MATLAB code for PoseEstimator.fig
% POSEESTIMATOR, by itself, creates a new POSEESTIMATOR or raises the existing
% singleton*.
%
% H = POSEESTIMATOR returns the handle to a new POSEESTIMATOR or the handle to
% the existing singleton*.
%
% POSEESTIMATOR('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in POSEESTIMATOR.M with the given input arguments.
%
% POSEESTIMATOR('Property','Value',...) creates a new POSEESTIMATOR or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before PoseEstimator_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to PoseEstimator_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 PoseEstimator
% Last Modified by GUIDE v2.5 17-Apr-2017 00:08:57
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @PoseEstimator_OpeningFcn, ...
'gui_OutputFcn', @PoseEstimator_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 PoseEstimator is made visible.
function PoseEstimator_OpeningFcn(hObject, ~, 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 PoseEstimator (see VARARGIN)
% Choose default command line output for PoseEstimator
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes PoseEstimator wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = PoseEstimator_OutputFcn(~, ~, 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 PushButtonOpenVideo.
function PushButtonOpenVideo_Callback(~, ~, handles)
% hObject handle to PushButtonOpenVideo (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global xyloObj;
[FileName,PathName,FilterIndex] = uigetfile('*.mp4');
FullPath = strcat(PathName,FileName);
xyloObj = VideoReader(FullPath);
I = read(xyloObj, 1);
axes(handles.axes1);
imshow(I);
% --- Executes on button press in PushButtonProcess.
function PushButtonProcess_Callback(~, eventdata, handles)
% hObject handle to PushButtonProcess (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global xyloObj;
I_First = read(xyloObj, 1);
FrameAverage = double(rgb2gray(read(xyloObj, 1)));
for i=2:100
I = rgb2gray(read(xyloObj, i));
FrameAverage = (((double(FrameAverage))*(i-1)+(double(I)))/(i));
end
NumInFrames=get(xyloObj,'NumberOfFrames');
for frame=1:NumInFrames
II = read(xyloObj,frame);
In = rgb2gray(II);
[mIn, nIn] = size(In);
FD = uint8(zeros(mIn,nIn));
FrameDiff = abs(double(FrameAverage)-double(In));
FD(FrameDiff(:)>50)=255;
axes(handles.axes1);
imshow(II);
axes(handles.axes2);
imshow(FD);
FDB = boundaries(FD);
[mFDB , ~] = size(FDB);
if mFDB ~= 0
FDBS = SortSignificanceFirst(FDB);
HF = FDBS(1,1);
min_P = min(HF);
MAX_P = max(HF);
mR = min_P(1,1);
mC = min_P(1,2);
MR = MAX_P(1,1);
MC = MAX_P(1,2);
Block = uint8(zeros(mIn,nIn));
BO = DrawHead(Block,mR,mC,MR,MC);
HO = DrawBody(BO,mR,mC,MR,MC);
LO = DrawLegs(HO,mR,mC,MR,MC);
WO = DrawHands(LO,mR,mC,MR,MC);
BW3 = bwmorph(FD,'skel',Inf);
axes(handles.axes3);
imshow(WO);
end
end
  1 件のコメント
Guillaume
Guillaume 2017 年 7 月 11 日
  • Use the {}Code format buttom
  • Are we supposed to guess where in that long dump is the error is occuring? Provide the complete error message, including the bit that tells you which line is causing the error.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by