error using imwrite which gives Can't open file "1.jpg" for writing. You may not have write permission.

1 visualizzazione (ultimi 30 giorni)
my program is as follows
clc; close all; clear all;
myVid= VideoReader('BS.avi');
numFrames= myVid.NumberOfFrames;
i= 1;
while i<=numFrames
currentFrame= read(myVid,i);
combinedString=strcat(int2str(i),'.jpg');
imwrite(currentFrame,combinedString);
i=i+1;
end
  1 Commento
Geoff Hayes
Geoff Hayes il 25 Ott 2014
You will need to verify that you have permissions to write files to the current directory. Just prior to running your program, type the following in the Command Window
fileattrib
What does the UserWrite field show?

Accedi per commentare.

Risposte (1)

Image Analyst
Image Analyst il 25 Ott 2014
Modificato: Image Analyst il 25 Ott 2014
What folder does it say when you issue this command just before your loop"
pwd
It looks like you want to extract all the frames of a video into separate image files. That is exactly what my attached demo do. Simply change the file name and use it. The second half rebuilds a video from the separate frames. You can remove that part if you want.

Community Treasure Hunt

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

Start Hunting!

Translated by