Problem in imwrite command
2 views (last 30 days)
NAVNEET NAYAN on 24 Sep 2020
I am stuck in a piece of code. Sometimes it works absolutely fine and sometimes the same code shows error. Let me explain the entire work I am doing. I have stored the LAP ISOGD dataset in a folder. In this dataset there is a folder named 'Train' which contains 180 folders. Each of these 180 folders contain depth and RGB videos. First half is the depth videos and second half contains RGB videos. I have to access these RGB videos one by one, then do some processing on each frame of all the RGB videos contained in all these 180 folders. While writing the code, I am able to access them all, and after accessing and extracting the frames I am trying to save all those frames in the similar way as it had been saved in the dataset.
eg: Suppose I accessed video 'train/001/M_00001.avi'. then after extracting the frames I want to write and save the frames in a folder named 'Navneet1/001/M_00001/...'.
I am attaching here the piece of code I am working on. And also the screenshot of error I am getting.
Folder='E:\PhD ppts and papers\datasets\ISOGD\train';
%accessing the basic folder
% making a new parent folder in which the extracted frames will be saved.
% Using the for loop to access the 180 folders conatined in folder 'train'.
% first 2 elemnts of s are '.' and '..' so m starts from 3, as the third
% element contains the first folder 001 and 182nd element contains 180th
% extracting the entity 'name' from the structure 's' formed in line no. 6
% giving path to all 180 folders one-by-one
%accessing each of these 180 folders one-by-one
% first 2 elemnts of s1 are '.' and '..' and 1st half of videos are depth videos,
% so n starts from (length(s1)/2)+2) and ends at length(s1)
% extracting the entity 'name' from the structure 's1' formed in
% line no. 19
%giving path to read videos one-by-one i.e. all RGB videos from
%folder 001 and then all RGB videos from folder 002 and so on till
%last RGB video of 180th folder
%extracting number of frames.
% giving path of subfolders under the parent folder 'Navneet1' to save
%this for loop is to write the frames in the specified folder
for iFrame = 1:1:numframe
frames = read(vid, iFrame);
imwrite(frames, fullfile('Navneet1',a,b,sprintf('%06d.jpg', iFrame)));
In case of any query regarding the clarification of problem, feel free to comment. Any suggestion regarding my task and problem is wholeheartedly welcome.