動画からフレーム抽出の後、輝度を求める
17 views (last 30 days)
Show older comments
動画ファイル(全1054フレーム)からフレームを抽出し、各フレーム毎のピクセルに対する輝度を求めたいと考えております。
各フレーム抽出の後、輝度算出の方法をご教示願います。よろしくお願いいたします。
1 Comment
Answers (1)
Kenta
on 18 Jul 2020
こんにちは、上のURLが使えると思います。上ではROIを切り出していますが、切り出さない場合は以下のようにすればよいとおもいます。
こちらでいかがでしょうか?
%% 第一フレームの読み取り
close all;clear;clc
Video = VideoReader('shuttle.avi');
%% 各フレームを読み取り=>そのフレームの輝度を計算
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_list(i)=int;
i=i+1;
end
%% グラフの表示
figure;
plot(1:i-1,int_list')
xlim([1 i-1])
xlabel('フレーム数')
ylabel('平均輝度')
title('各フレームにおけるROIの平均輝度')
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!