Borrar filtros
Borrar filtros

Vibration frequency measurement by video

4 visualizaciones (últimos 30 días)
大空
大空 el 28 de Jun. de 2023
I have a robot that uses a vibration motor to move forward using the force of vibration. I would like to take video of the leg vibrations and measure the vibration frequency. I think there are three steps: reading the video, extracting information from the frame, and calculating the number of vibrations. I would appreciate it if you could tell me how to input information such as color and shape.
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

Respuestas (0)

Categorías

Más información sobre 振動解析 en Help Center y File Exchange.

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!