How to calculate Geodesic distance of human motion video in matrix

1 visualizzazione (ultimi 30 giorni)
I have (144 x 10800) or (25920 x 60) matrix as attached file.
The matrix was made background subtraction in video.
%// read the video:
reader = VideoReader('lena_side.avi');
vid = {};
while hasFrame(reader)
vid{end+1} = im2single(readFrame(reader));
end
%// simple background estimation using mean:
bg = mean( cat(4, vid{:}), 4 );
%// estimate foreground as deviation from estimated background:
for i=1:60
fIdx(i) = i; %// do it for frame 1 ~ 60
fg{i} = sum( abs( vid{fIdx(i)} - bg ), 3 ) > 0.25;
fg{i} = reshape(fg{i},[],1);
end
D1 = cell2mat(fg);
How can I calculate Geodesic distance in matrix? I wanna use the geodesic distance.

Risposte (1)

Pranjal Kaura
Pranjal Kaura il 28 Set 2021
Hey Kong,
You could use the bwdistgeodesic function to compute the geodesic distance for an image.
"bwdistgeodesic" accepts a binary image as input, so you would have to transform the frames in your video to binary images. You can use rgb2gray and imbinarize functions for this.
Hope this helps!

Community Treasure Hunt

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

Start Hunting!

Translated by