segsAll = cell(length(frs),1);
This line of code is unreachable I don't know why. I have supplied the image properly and also tried to display it and it got displayed. But error is still there, something wrong with the if statement.
if true % code
%Define our movie and scale factor
cd demo_people;addpath(genpath('.'));frs = 1:201;movieS = 'ims/%.8d.jpg';imscale = .6;%First step; run stylized pose detector on each frame
INIT_DETECT = 0;if INIT_DETECT %First, run our stylized person detector
segsAll = cell(length(frs),1); %for fr = frs,
for fr = 167 fr %Read in image, scaling it so torso is roughly 50 pixels long
imOrig = imread(sprintf(movieS,fr)); %For this sequence, hard-code in we're looking for some-one
% walking to the right with a torso 50 pixels high
im = imresize(imOrig(:,end:-1:1,:),imscale,'bilinear'); % Because the walking detector involves sampling, may have to
% do this multiple times
% and take best-scoring one
segs = findWalkingPerson(im); %Flip and re-size to regular image
[segs.x,segs.u] = deal(size(im,2) - segs.x + 1,-segs.u); [segs.x,segs.y,segs.len,segs.w] = ... deal(segs.x/imscale,segs.y/imscale,segs.len/imscale,segs.w/imscale); %Build an appearance model for each limbs and evaluate how
% good we are
modelSegs = buildLimbModelLin({imOrig},{segs}); %Sum up the fraction of missclassified pixels, downweighting
% the upper arm by .5
segs.cost = [1 .5 1 1 1 1 1 1] * modelSegs.err; segsAll{fr} = segs; end %Take the best scoring one
costs = repmat(100,length(frs),1); for i = 1:length(frs), if ~isempty(segsAll{i}), costs(i) = segsAll{i}.cost; end end [dummy,fr] = min(costs); %Build a quadratic logistic regression model for each limb
im = imread(sprintf(movieS,fr)); modelSegs = buildLimbModelQuad({im},segsAll(fr)); save walkingDetections segsAll modelSegs; else load walkingDetections; end%Track by detecting with learned appearance model
trackSegs = cell(length(frs),1);for fr = frs, fr clf; im = imread(sprintf(movieS,fr)); %Can search over image and different scales if desired
im = imresize(im,imscale,'bilinear'); subplot(231); imshow(im); title(sprintf('Frame %d',fr)); %Sample body poses by computing the posterior with the
% sum-product algorithm
[pts,cost] = findGeneralPerson(im,modelSegs); subplot(235); showPersonPts(size(im),pts); title('Posterior'); %Find the modes in the samples
trackSegs{fr} = findModePose(pts); subplot(236); showsegIm(im,trackSegs{fr}); title('Mode in posterior'); drawnow;end%Show the track
clf;set(gcf,'doublebuffer','on');for fr = frs, im = imread(sprintf(movieS,fr)); %Can search over image and different scales if desired im = imresize(im,imscale); showsegIm(im,trackSegs{fr}); drawnow;endend
Best Answer