Effacer les filtres
Effacer les filtres

Problem with imwrite when creating multiple Image Files

1 vue (au cours des 30 derniers jours)
Dimitris M
Dimitris M le 12 Mai 2012
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

Réponse acceptée

Dimitris M
Dimitris M le 12 Mai 2012
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 commentaire
Image Analyst
Image Analyst le 12 Mai 2012
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

Connectez-vous pour commenter.

Plus de réponses (2)

Image Analyst
Image Analyst le 12 Mai 2012
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 commentaires
Dimitris M
Dimitris M le 12 Mai 2012
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 le 12 Mai 2012
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.

Connectez-vous pour commenter.


Dimitris M
Dimitris M le 12 Mai 2012
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

Catégories

En savoir plus sur Standard File Formats dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by