動画から振動数を読み取る
    3 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
ロボットを振動モータを使い振動の力を利用して前進させています。足を振動させて移動しているのですが脚の振動を動画を撮り振動数を測りたいです。手順は動画の読み取り、フレームから情報抽出、振動数の計算この三段階になると思うのですがフレーム情報抽出の際の脚の位置の特定の仕方はどのように行うのでしょうか?色や形などの情報の入力方法が分からず教えていただけたら幸いです。
videoFile = 'videoFile.mp4'; 
v = VideoReader(videoFile);
legPositions = []; 
while hasFrame(v)
    frame = readFrame(v); % フレームを読み込む
    gray = rgb2gray(frame); % RGB画像をグレースケール画像に変換
    % 白色の脚に相当するグレースケールの範囲を指定
    grayThresholdLow = 200;   % グレースケールの下限
    grayThresholdHigh = 255;  % グレースケールの上限
    % グレースケールに基づいて脚の位置を二値化
    legMask = (gray > grayThresholdLow) & (gray < grayThresholdHigh);
    % 連結成分のラベリングを行い、各オブジェクトを識別
    labeledImage = bwlabel(legMask);
    % 各オブジェクトの位置(重心)を計算
    properties = regionprops(labeledImage, 'Centroid');
    centroids = cat(1, properties.Centroid);
    legPositions = [legPositions; centroids]; % 脚の位置を保存
end
0 Commenti
Risposte (0)
Vedere anche
Categorie
				Scopri di più su Deep Learning Toolbox in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!