having trouble using parallel computing in image proccesing

조회 수: 1 (최근 30일)
noam Y
noam Y 2018년 5월 4일
편집: noam Y 2018년 5월 5일
Hello, I'm trying to process a video and create an output video from modified frames.
because I have a multi-core machine I'm using parfor to accelerate the process,
the problem is that every iteration all of the Matlab workers take the same frame instead of reaching for the next one. any advice? my code:
video = VideoReader('file_name.mov');
outputVideo = VideoWriter(fullfile('destenation folder\','output file name.avi'));
outputVideo.FrameRate = video.FrameRate;
open(outputVideo);
frame=0;
while hasFrame(video)
if frame>=video.FrameRate*5&&frame<=video.FrameRate*7
images = cell(1,6);
parfor frm=1:6
frame = frame +1;
img = readFrame(video);
images{frm} = RetrieveOutputimg(img);
end
for image=1:6
try
writeVideo(outputVideo,images{image});
figure;
imshow(images{image});
catch
end
end
else
frame = frame +1;
readFrame(video);
end
end
close(outputVideo);

답변 (0개)

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by