Error using imwrite (line 463) Can't open file "C:\Program Files\MATLAB\R2011b\bin\frames\fr1.jpj" for writing. You may not have write permission. Error in manzil (line 29) imwrite(img,outputFullFileName,'jpg');
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
m executing the below code and obtaining error like this
- PERMISSION IS DENIED FOR MKDIR
- Error using imwrite (line 463) Can't open file "C:\Program Files\MATLAB\R2011b\bin\frames\fr1.jpj" for writing. You may not have write permission. Error in extractframe (line 29) imwrite(img,outputFullFileName,'jpg');
SO WHAT I SHD DO???
if true
% clc ; % clearing the command window
n = input(' Enter the number of photos to be taken: ');
intervel = input(' Enter the time(seconds) gap between succeessive photos: ');
photosave = input(' Do you want to save the files(y/n): ','s');
disp('Please wait...');
outputFolder = fullfile(cd, 'Test');
if ~exist(outputFolder, 'dir')
clc ; % clearing the command window
n = input(' Enter the number of photos to be taken: ');
intervel = input(' Enter the time(seconds) gap between succeessive photos: ');
photosave = input(' Do you want to save the files(y/n): ','s');
disp('Please wait...');
outputFolder = fullfile(cd, 'frames');
% if ~exist(outputFolder, 'dir')
% mkdir(outputFolder);
% end
obj = videoinput('winvideo',1);
preview(obj);
disp('Press Enter to start after webcam initialization.');
pause;
disp('First shot will taken after 3 second');
pause(3);
for i=1:n
img=getsnapshot(obj);
image(img);
if(photosave == 'y')
outputBaseFileName = sprintf('fr%d.jpj',i);
outputFullFileName = fullfile(outputFolder, outputBaseFileName);
imwrite(img,outputFullFileName,'jpg');
end
pause(intervel);
end
closepreview;
disp('The program successfully taken the photos');
disp('Done.');mkdir(outputFolder);
end
obj = videoinput('winvideo',1);
preview(obj);
disp('Press Enter to start after webcam initialization.');
pause;
disp('First shot will taken after 1 second');
pause(1);
for i=1:n
img=getsnapshot(obj);
image(img);
if(photosave == 'y')
outputBaseFileName = sprintf('fr%d.png',i);
outputFullFileName = fullfile(outputFolder, outputBaseFileName);
imwrite(img,outputFullFileName,'jpg');
end
pause(intervel);
end
closepreview;
disp('The program successfully taken the photos');
disp('Done.');
end
0 commentaires
Réponse acceptée
Image Analyst
le 24 Mai 2013
Unlike Windows XP, writing to anything under the Program Files folder in Windows 7 is practically prohibited, though there are ways around it. You're expected to keep all your documents on a secondary hard drive (like I do), or in the "C:\Users\yourLoginName\Documents" folder. Replace this:
outputFolder = fullfile(cd, 'Test');
with this:
outputFolder = 'C:\Users\Mohd\Test'; % or frames instead of test.
Plus de réponses (1)
Walter Roberson
le 24 Mai 2013
Modifié(e) : Walter Roberson
le 24 Mai 2013
Start from a different directory so that you are not trying to write underneath the MATLAB directory
0 commentaires
Voir également
Catégories
En savoir plus sur Startup and Shutdown dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!