필터 지우기
필터 지우기

How Can I draw histogram of all video's frames?

조회 수: 2 (최근 30일)
Roaa Alnafea
Roaa Alnafea 2022년 1월 31일
답변: Benjamin Thompson 2022년 1월 31일
I am trying to run this code in parallel to read each video frame , take the direction gradient , and substracting histogram of current frame and next one, then show the result histogram
I have get this error message:(Dot indexing is not support for variable of this type)
What should I fix in the following code?
function [] = parfun()
tic
vid = VideoReader('002.mp4');
vid.CurrentTime = 0;
vidlen = vid.NumFrames;
parfor i = 1:vidlen
temp = read(vid,i);
temp2 = read(vid,i+1);
gradframe = imgradientxy(temp);
gradframe2 = imgradientxy(temp2);
tohisto = histogram(gradframe)- histogram(gradframe2);
figure
histogram(tohisto);
end
toc
end
  댓글 수: 2
Geoff Hayes
Geoff Hayes 2022년 1월 31일
@Roaa Alnafea - please copy and paste the full error message so that it is clear which line of code is throwing the error.
Roaa Alnafea
Roaa Alnafea 2022년 1월 31일
Error using parfun (line 13)
Dot indexing is not support for variable of this type

댓글을 달려면 로그인하십시오.

채택된 답변

Benjamin Thompson
Benjamin Thompson 2022년 1월 31일
Use readFrame to read a single video frame from a VideoReader object. But note that reading frames from a VideoReader is not parallellizable on its own, since the frames come from a sequential video file source and it is usually not possible to know exactly where in the file future frames will start. Plus with lossy compression algorithms future frames usually depend on a past frame.
You could, however, load a set of frames in a sequential manner and then perform processing on the set using parfor. You will have to choose the size of the set based on the number of cores available and memory limits.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Tracking and Motion Estimation에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by