How to crop images and save it to matrix after vision.ForegroundDetector
Show older comments
Hello. Vision.ForegroundDetector is so amazing!
Could you let me know how to get several images inbox as a matrix?
I want to save these images as matrix.
I want to use several images like this. How can I crop this like image?

I am using this code.
videoSource = VideoReader('shahar_run.avi');
detector = vision.ForegroundDetector(...
'NumTrainingFrames', 5, ...
'InitialVariance', 30*30);
blob = vision.BlobAnalysis(...
'CentroidOutputPort', false, 'AreaOutputPort', false, ...
'BoundingBoxOutputPort', true, ...
'MinimumBlobAreaSource', 'Property', 'MinimumBlobArea', 250);
shapeInserter = vision.ShapeInserter('BorderColor','White');
videoPlayer = vision.VideoPlayer();
while hasFrame(videoSource)
frame = readFrame(videoSource);
fgMask = detector(frame);
bbox = blob(fgMask);
out = shapeInserter(fgMask,bbox);
videoPlayer(out);
pause(0.1);
end
2 Comments
Ameer Hamza
on 22 Mar 2020
Can you attach the actual image or the video file?
Kong
on 22 Mar 2020
Accepted Answer
More Answers (0)
Categories
Find more on Detect, Extract, and Match Features in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!