hasFrame
ビデオ フレームが読み取り可能かどうかを判別
説明
例
VideoReader
オブジェクトの作成とビデオの読み取り
サンプル ビデオ ファイル xylophone_video.mp4
の VideoReader
オブジェクトを作成します。
v = VideoReader("xylophone_video.mp4");
ビデオから、1 フレームずつすべてのフレームを読み取ります。
while hasFrame(v) frame = readFrame(v); end
readFrame
によって返された最後のフレームに関する情報を表示します。
whos frame
Name Size Bytes Class Attributes frame 240x320x3 230400 uint8
VideoReader
オブジェクトをクリアします。
clear v
ムービー ファイルの読み取りと再生
サンプル ビデオ ファイル xylophone_video.mp4
の VideoReader
オブジェクトを作成します。次にビデオの幅と高さを決めます。
xyloObj = VideoReader("xylophone_video.mp4");
vidWidth = xyloObj.Width;
vidHeight = xyloObj.Height;
ビデオ構造体配列を作成します。
mov = struct("cdata",zeros(vidHeight,vidWidth,3,"uint8"),colormap=[]);
ビデオの最後までフレームを 1 つずつ読み取ります。
k = 1; while hasFrame(xyloObj) mov(k).cdata = readFrame(xyloObj); k = k+1; end
ビデオの幅と高さに基づいて Figure のサイズを設定し、ビデオを 1 回再生します。
vf = figure(Position=[0 0 xyloObj.Width xyloObj.Height]);
imshow(mov(1).cdata,Border="tight")
movie(vf,mov,1,xyloObj.FrameRate)
VideoReader
オブジェクトをクリアします。
clear xyloObj
入力引数
v
— 入力 VideoReader
オブジェクト
VideoReader
オブジェクト
入力 VideoReader
オブジェクト。関数 VideoReader
を使用してビデオ ファイルから VideoReader
オブジェクトを作成します。
拡張機能
C/C++ コード生成
MATLAB® Coder™ を使用して C および C++ コードを生成します。
バージョン履歴
R2014b で導入
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)