필터 지우기
필터 지우기

Problem with imwrite when creating multiple Image Files

조회 수: 1 (최근 30일)
Dimitris M
Dimitris M 2012년 5월 12일
Hello
I am encountering a strange problem during a process of saving multiple image files in my hard disk.
More specifically the problem occurs while I am processing some photos and the saving them sequentially. As I have seen the problem occurs always when the sequence arrives in the 13th Image (strange!).
It seems strange to me as this work for the previous images and only on this step, that follows exact the same procedure (is done automatically) I have the error. Do you have any idea what could it be ?
The error I am taking is :
You may not have write permission.
Error in ==> Automatization at 479
imwrite(Seg_Out_1{2,Num_Seg},[ImageExpDir,sprintf(Exp_Name_2,Num_Seg,a,b,c,d,e,f,g,h,i,j,k)],'tif');
Thank you in advance

채택된 답변

Dimitris M
Dimitris M 2012년 5월 12일
Hello
I just found out something. The problem is that the name of the sprintf function is too big. So when I minimize the size know works.
Is there any limit is the name that you can give to a file using sprintf function ?
Or maybe also that windows do not allow so large names for their image files too !
  댓글 수: 1
Image Analyst
Image Analyst 2012년 5월 12일
That doesn't make sense. The name of the sprintf() function is 7 characters. Windows has a maximum length of 260 characters for filenames. See http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx

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

추가 답변 (2개)

Image Analyst
Image Analyst 2012년 5월 12일
That does not look like a proper sprintf() statement. Where is your format string? And why not use fullfile() instead of [,]? Try creating the filename in advance and printing it out to the command line so you can see what it is. Something like
baseFileName = sprintf('%s%d%d%d%d%d%d%d%d%d%d%d%d.tif', ...
Exp_Name_2,Num_Seg,a,b,c,d,e,f,g,h,i,j,k)
fullFileName = fullfile(ImageExpDir, baseFileName)
imwrite(Seg_Out_1{2,Num_Seg}, fullFileName);
  댓글 수: 2
Dimitris M
Dimitris M 2012년 5월 12일
Hello
I did the modification you suggested and I still get the same error. It is still very strange to me as I create 4 images in every segmentation step. These have been already 12 times created sequentially without any problem and still on the 13th iteration I get this error.
Any other suggestions ?
Thank you
Image Analyst
Image Analyst 2012년 5월 12일
What was the filename when it bombed? I can't really debug much until you decide to share more code. I think there's something you're not telling us. Perhaps one of the a-k variables is not an integer or there's some other mismatch in the variables and the format specifier string. Or perhaps there's some character in filename that is not a valid character for files, such as : / \ ? * etc. or some non printable character such as hex 0 - 31 or something like that.

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


Dimitris M
Dimitris M 2012년 5월 12일
I am not sure what was the problem but know the algorithm really works so I don't really know what to say about this !
Anyway thanks for your help ~!
Greetings from Greece

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by