permission error while using imwrite () on transformed image

i have multiple images in multiple folders. i have perform a deformation on those images and trying to save those images in same folders under the name transform image using imwrite(). but i am getting write permission error . Can anyone help me with this. Please find my code attached.

回答 (1 件)

Image Analyst
Image Analyst 2016 年 7 月 9 日

0 投票

Don't use "image" as the name of your image variable - it's an important built-in function. What is the name of your file you are trying to write? If you comment out the imwrite() line, does the script run fine?

4 件のコメント

prashant singh
prashant singh 2016 年 7 月 9 日
編集済み: prashant singh 2016 年 7 月 9 日
did not use 'image' this time ... used im instead, still no luck. if i comment out imwrite ..it goes through all of my images in different folders but make only the first folder where i need to save the transformed images. rest of the image directory it doesn't make . Like it prepare the folders trasnform2Dimages ->transformdata-60.. while iterating through the first folder where it's picking up the images but then it doesn't create the next folder or the folders after that . It should create folders like trasnform2Dimages ->transformdata-61 , trasnform2Dimages ->transformdata-62. Please find the updated code attached.
Image Analyst
Image Analyst 2016 年 7 月 9 日
Paste the contents of everything that appears in the command window.
prashant singh
prashant singh 2016 年 7 月 9 日
Processing image file C:\Users\PRASHANT\Documents\MATLAB\2Dimages\data\data-1\image98.jpeg
Warning: Directory already exists.
> In deform2D (line 58)
Processing folder C:\Users\PRASHANT\Documents\MATLAB\2Dimages\data\data-10
Processing image file C:\Users\PRASHANT\Documents\MATLAB\2Dimages\data\data-10\image103.jpeg
Warning: Directory already exists.
> In deform2D (line 58)
Processing image file C:\Users\PRASHANT\Documents\MATLAB\2Dimages\data\data-10\image108.jpeg
Warning: Directory already exists.
> In deform2D (line 58)
Processing image file C:\Users\PRASHANT\Documents\MATLAB\2Dimages\data\data-10\image113.jpeg
Warning: Directory already exists.
> In deform2D (line 58)
Processing image file C:\Users\PRASHANT\Documents\MATLAB\2Dimages\data\data-10\image118.jpeg
Warning: Directory already exists.
> In deform2D (line 58)
Processing image file C:\Users\PRASHANT\Documents\MATLAB\2Dimages\data\data-10\image123.jpeg
Warning: Directory already exists.
> In deform2D (line 58)
Processing image file C:\Users\PRASHANT\Documents\MATLAB\2Dimages\data\data-10\image128.jpeg
Warning: Directory already exists.
> In deform2D (line 58)
Processing image file C:\Users\PRASHANT\Documents\MATLAB\2Dimages\data\data-10\image133.jpeg
This is what i am getting if i comment down imwrite(). It keeps eso i executing for a large image database so i pasted some part of it
Image Analyst
Image Analyst 2016 年 7 月 9 日
You can get rid of a lot of the warnings by not calling mkdir if the folder exists:
Replace
mkdir(dataFolderName);
by
if ~exists(dataFolderName, 'dir')
mkdir(dataFolderName);
end
then you'll have to put the imwrite back in so I can see what the error for that is. Perhaps you can't write to the folder, like it's on a readonly drive or need admin permission or something.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeImages についてさらに検索

質問済み:

2016 年 7 月 9 日

コメント済み:

2016 年 7 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by