Tracking a clay target using foreground detection using Gaussian mixture models inconsistently identifying the target.
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Josh Anderson
il 2 Set 2015
Risposto: Josh Anderson
il 3 Set 2015
I am working on a project to use stereo vision to track a shooters aim and a clay target in flight and try and calculate the distance the shooter misses by. I have colored markers on the gun to assist with the aim but I am having trouble tracking the clay target.
I am using some code i have adapted from one of the online examples, which so far identifies the target in only a few out of the 10 frames in my video. Any help that you can give is greatly appreciated.
The code that i am currently using is:
% defines min/max blob sizes
minsize = 8;
maxsize = 100;
videoSource = vision.VideoFileReader('L_Trial2.avi','VideoOutputDataType','uint8');
detector = vision.ForegroundDetector('NumTrainingFrames', 5,...
'InitialVariance', 200, 'NumGaussians', 8, 'MinimumBackgroundRatio', 0.1);
blobbbox = vision.BlobAnalysis(...
'CentroidOutputPort', false, 'AreaOutputPort', false, ...
'BoundingBoxOutputPort', true, ...
'MinimumBlobAreaSource', 'Property', 'MinimumBlobArea', minsize,...
'MaximumBlobAreaSource', 'Property', 'MaximumBlobArea',maxsize);
shapeInserter = vision.ShapeInserter('BorderColor','White');
videoPlayer = vision.VideoPlayer();
for i = 1:10
frame = step(videoSource);
fgMask = step(detector, frame);
bbox = step(blobbbox, fgMask);
out = step(shapeInserter, frame, bbox);
step(videoPlayer, out);
pause(0.5)
end
release(videoPlayer);
release(videoSource);
Links to this .m file, and the video i am using are:
https://www.dropbox.com/s/w3ysdsgjuj9sqa9/GetTargetLocCutdown.m?dl=0
https://www.dropbox.com/s/0vshthqtha5i6by/L_Trial2.avi?dl=0
2 Commenti
Risposta accettata
Più risposte (1)
Dima Lisin
il 2 Set 2015
Modificato: Dima Lisin
il 2 Set 2015
Hi Josh,
There are several issues here. One is that the target is very small. I had to watch the video a few times before I even noticed it. It would help if you could make the target look bigger in the video. You could move the camera closer, use a zoom lens, or a use higher resolution camera.
The other issue is that you only have 10 frames. vision.ForegroundDetector learns the background over time. If you start recording some time before the first target is launched, it will give the foreground detector time to learn what the background pixel values are, and it will be better able to distinguish the target from noise.
Vedere anche
Categorie
Scopri di più su Detection in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!