How to find centroid of image and crop image in several images

1 回表示 (過去 30 日間)
Kong
Kong 2020 年 3 月 18 日
編集済み: Kong 2020 年 3 月 18 日
Hello.
I want to convert video to binary image.
And then I want to find center and crop image.
Binay image cropped image
I want to use several images in a folder using for loop. Could I get an idea about this?
Basiclly, I will use this code to convert video to images.
clear all
close all
%// read the video:
reader = VideoReader('shahar_bend.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:40
fIdx(i) = i; %// do it for frame 1 ~ 60
fg{i} = sum( abs( vid{fIdx(i)} - bg ), 3 );
fg{i} = imresize(fg{i}, 0.3);
fg{i} = reshape(fg{i},[],1);
end
X = cell2mat(fg);
data = double(X);

採用された回答

Image Analyst
Image Analyst 2020 年 3 月 18 日
This is EXACTLY what my Image Segmentation Tutorial does.
Find it in my File Exchange.
  5 件のコメント
Image Analyst
Image Analyst 2020 年 3 月 18 日
You forgot to attach 'shahar_bend.avi'.
Kong
Kong 2020 年 3 月 18 日
編集済み: Kong 2020 年 3 月 18 日
How to use image segmentation in video images - MATLAB Answers - MATLAB Central - https://www.mathworks.com/matlabcentral/answers/511399-how-to-use-image-segmentation-in-video-images
I attached here. Thank you so much

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by