Skip to content

Commit

Permalink
displaying all valid indexes for points, returning point-by-point ave…
Browse files Browse the repository at this point in the history
…rage in last step
  • Loading branch information
Matt committed Mar 30, 2014
1 parent 1885fef commit 3de388a
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 99 deletions.
2 changes: 1 addition & 1 deletion README.md
@@ -1,3 +1,3 @@
`runAll('the_video.avi',[],[]);` or `runAll('the_video.avi',leftMask,rightMask);`

* Make sure to add the Inscribed_Rectangle folder to Paths on Matlab
* Make sure to add the Inscribed_Rectangle folder to Paths in Matlab
22 changes: 13 additions & 9 deletions displayEars.m
Expand Up @@ -12,23 +12,27 @@
newVideo.Quality = 100;
newVideo.FrameRate = 20;
open(newVideo);

meanLeft = zeros(video.NumberOfFrames,2);
meanRight = zeros(video.NumberOfFrames,2);

%there is still no checking on whether or not 3 indexes even exist: if
%all points were crap, this will error out right now
samplePoints = 3;
% now that most variables undergo thresholding, we can plot all the
% indexes that appear at this stage
for i=1:video.NumberOfFrames
disp(['Writing video...' num2str(i)])
im = read(video,i);
meanLeft = mean(leftAllPoints(leftMaxIndexes(1:samplePoints),:,i));
im = insertShape(im,'Circle',[meanLeft 4],'Color','green');
meanRight = mean(rightAllPoints(rightMaxIndexes(1:samplePoints),:,i));
im = insertShape(im,'Circle',[meanRight 4],'Color','green');
for j=1:samplePoints; %how many points to plot
meanLeft(i,:) = mean(leftAllPoints(leftMaxIndexes,:,i));
im = insertShape(im,'Circle',[meanLeft(i,:) 4],'Color','green');
meanRight(i,:) = mean(rightAllPoints(rightMaxIndexes,:,i));
im = insertShape(im,'Circle',[meanRight(i,:) 4],'Color','green');
for j=1:size(leftMaxIndexes,1) %how many points to plot
im = insertShape(im,'FilledCircle',[leftAllPoints(leftMaxIndexes(j),:,i) 2]);
end
for j=1:size(rightMaxIndexes,1) %how many points to plot
im = insertShape(im,'FilledCircle',[rightAllPoints(rightMaxIndexes(j),:,i) 2]);
end
writeVideo(newVideo,im);
%imshow(im)
imshow(im)
end
close(newVideo);
end
13 changes: 6 additions & 7 deletions pointCompute.m
Expand Up @@ -33,8 +33,7 @@
figure;
hold on;
for i=1:size(allPointsDist,1) %points rows
diffDistance = diff(allPointsDist(i,:)); %change in distance
diffDistances(i,:) = diffDistance(1,:);
diffDistances(i,:) = diff(allPointsDist(i,:)); %change in distance
%plot(diffDistance);
plot(allPointsDist(i,:))
end
Expand Down Expand Up @@ -62,10 +61,10 @@
hold on;
for i=1:size(allPointsPhase,1) %points rows
maxDiffPhases(i,:) = max(abs(diff(allPointsPhase(i,:))));
plot(allPointsPhase(i,:)); % plot this...
%plot(diff(allPointsPhase(i,:))); % or this, not together
%plot(allPointsPhase(i,:)); % plot this...
plot(diff(allPointsPhase(i,:))); % or this, not together
end
plot(1:size(allPointsPhase,2),avgPhase,'*','Color','green'); %along with this...
%plot(1:size(allPointsPhase,2),avgPhase,'*','Color','green'); %along with this...
hold off;

% if thresholds or points are too aggressive, this will error out
Expand All @@ -74,12 +73,12 @@
% threshold for large abberations
maxIndexes = maxIndexes(diffValue < 15);
% remove large phase changes, value from observation
thresholdDiffPhasesIndexes = find(maxDiffPhases<.012);
thresholdDiffPhasesIndexes = find(maxDiffPhases<.01);
maxIndexes = maxIndexes(ismember(maxIndexes,thresholdDiffPhasesIndexes));
%remove anything that has a disimilar angle, value from observation.
%This should not be too aggressive, if points lie above/below the angle
%of interest they will get caught. Mainly to make sure the point is not
%traveling sideways or backwards
thresholdPhasesIndexes = find(abs(avgPhase-mean(allPointsPhase,2))<.2);
thresholdPhasesIndexes = find(abs(avgPhase-mean(allPointsPhase,2))<.05);
maxIndexes = maxIndexes(ismember(maxIndexes,thresholdPhasesIndexes)); %remove phase abberations
end
82 changes: 0 additions & 82 deletions pointCompute.m~

This file was deleted.

Binary file removed sessions/NO_PPN BBN Trial 4_30032014_1351.mat
Binary file not shown.
Binary file added sessions/NO_PPN BBN Trial 4_30032014_1842.mat
Binary file not shown.
Binary file removed sessions/NO_PPN BBN Trial 8_30032014_1343.mat
Binary file not shown.
Binary file added sessions/NO_PPN BBN Trial 8_30032014_1909.mat
Binary file not shown.

0 comments on commit 3de388a

Please sign in to comment.