動画内の球体の速度を求めたい。
Afficher commentaires plus anciens
水中を流れる球体(白と赤の2種類)があり、その球の速度を求めたいです。動画内にはスケールがあるので距離はわかります。また、120fpsとフレーム数が多いのでそれを利用できる方法があればな、と考えております。
現在は、イメージ内の円形オブジェクトの検出と測定(https://jp.mathworks.com/help/images/detect-and-measure-circular-objects-in-an-image.html)や、交通量のビデオ内の車の検出(https://jp.mathworks.com/help/images/detecting-cars-in-a-video-of-traffic.html)、複数オブジェクトの追跡(https://jp.mathworks.com/help/vision/ug/multiple-object-tracking.html)、カルマン フィルターを使用したオブジェクトの追跡(https://jp.mathworks.com/help/vision/examples/using-kalman-filter-for-object-tracking.html) などを参考に動画をインポートし、任意のフレーム(画像)を選択し、色のしきい値を調整することで(静止画内の)対象とする球を検出することまで出来ています。現在動画上で検出できるように挑戦しているところなのですが、動画内で追跡できたとしても速度を求める方法が見当たりません。
球の速度を求める方法(またはアイデア)を教えていただきたいです。
本ケースでは水中ということで背景も多少変化してしまうので、追跡等にも苦戦しています。
年内に完成させなければならず、行き当たりばったりなことができないので質問させていただきました。よろしくお願いいたします。
I=VideoReader('---.MP4')
%下式は動画Iの中の700フレーム目を画像として呼び出す
J=read(I,700);
imshow(J)
[BW,maskedRGBImage] = createMask1(J);
[centers,radii] = imfindcircles(BW,[15 28],'ObjectPolarity','bright','Sensitivity',0.91)
imshow(BW)
h = viscircles(centers,radii);
imshow(J)
h = viscircles(centers,radii);
以下、createMask1.m
function [BW,maskedRGBImage] = createMask(RGB)
I = rgb2lab(RGB);
channel1Min = 25.436;
channel1Max = 100.000;
channel2Min = 3.650;
channel2Max = 65.432;
channel3Min = 15.507;
channel3Max = 64.797;
% Create mask based on chosen histogram thresholds
sliderBW = (I(:,:,1) >= channel1Min ) & (I(:,:,1) <= channel1Max) & ...
(I(:,:,2) >= channel2Min ) & (I(:,:,2) <= channel2Max) & ...
(I(:,:,3) >= channel3Min ) & (I(:,:,3) <= channel3Max);
BW = sliderBW;
% Initialize output masked image based on input image.
maskedRGBImage = RGB;
% Set background pixels where BW is false to zero.
maskedRGBImage(repmat(~BW,[1 1 3])) = 0;
end
2 commentaires
Shunichi Kusano
le 24 Déc 2019
シンプルに速度=距離÷時間の公式に則って計算するのではうまくいかなそうなのでしょうか。
Eiji Ishioka
le 24 Déc 2019
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur 記述統計 dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!