動画の平均輝度の時間プロット
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
aviなどの形式の動画について、全画面又はエリアを指定した上で、横軸が時間(又はフレーム)、縦軸が平均輝度のグラフを描画するにはどうすればよいでしょうか?
0 commentaires
Réponse acceptée
Kenta
le 23 Mar 2019
%% 第一フレームの読み取り
close all;clear;clc
Video = VideoReader('shuttle.avi');
img = readFrame(Video);
figure;imshow(img)
%% 関心領域を指定(左クリックで対象の多角形を作成=>右クリック=>マスクの作成)
ROI = roipoly;
index=find(ROI==1);
close all
%% 各フレームを読み取り=>そのフレームの輝度を計算
i=1;
Video.CurrentTime=0; %1フレーム目から読み取り
int_list=zeros(1,round(Video.Duration*Video.FrameRate));
while hasFrame(Video)
img = readFrame(Video);
int=mean(img,3);
int_in_ROI=int(index);
int_list(i)=mean(int_in_ROI);
i=i+1;
end
%% グラフの表示
figure;
plot(1:i-1,int_list')
xlim([1 i-1])
xlabel('フレーム数')
ylabel('平均輝度')
title('各フレームにおけるROIの平均輝度')
roipolyでクリックしながら、対象領域を指定すれば、その領域のフレームごとの輝度が求まると思います。
各時間ごとがよければ、横軸の値にフレームレートの逆数をかけてください。
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur オーディオとビデオ dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!