필터 지우기
필터 지우기

permission error while using imwrite () on transformed image

조회 수: 2 (최근 30일)
prashant singh
prashant singh 2016년 7월 9일
댓글: Image Analyst 2016년 7월 9일
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일
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일
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.

댓글을 달려면 로그인하십시오.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by