hasFrame
비디오 프레임을 읽을 수 있는지 확인
설명
예제
VideoReader
객체를 만들고 비디오 읽기
샘플 비디오 파일 xylophone_video.mp4
에 대한 VideoReader
객체를 만듭니다.
v = VideoReader("xylophone_video.mp4");
비디오에서 모든 프레임을 한 번에 한 프레임씩 읽습니다.
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=[]);
비디오의 끝까지 한 번에 한 프레임씩 읽어옵니다.
k = 1; while hasFrame(xyloObj) mov(k).cdata = readFrame(xyloObj); k = k+1; end
비디오의 너비와 높이에 기반하여 Figure 크기를 정한 다음 비디오를 한 번 재생합니다.
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 명령 창에 입력하십시오. 웹 브라우저는 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)