How to calculate Geodesic distance of human motion video in matrix

1 回表示 (過去 30 日間)
Kong
Kong 2020 年 3 月 11 日
回答済み: Pranjal Kaura 2021 年 9 月 28 日
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.

回答 (1 件)

Pranjal Kaura
Pranjal Kaura 2021 年 9 月 28 日
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!

カテゴリ

Help Center および File ExchangeGeometric Geodesy についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by