Problems writing a tiff file

1 visualización (últimos 30 días)
Sebastian G
Sebastian G el 7 de Mzo. de 2013
When I write an array as tiff, change the values.
if true
% code
end
I=round(rand(10,10,3)*10);
file='c:\temp';
for i=1:3
imwrite(I(:,:,i),'file','WriteMode','append');
end if true
if true
% code
end
thank you very much
  1 comentario
Jan
Jan el 7 de Mzo. de 2013
Please explain with more details, which values are changed.

Iniciar sesión para comentar.

Respuestas (2)

Jan
Jan el 7 de Mzo. de 2013
Editada: Jan el 7 de Mzo. de 2013
imwrite(I(:,:,i), 'file', 'WriteMode', 'append');
This writes to the file called 'file' in the current directory. I guess you want:
file='c:\temp\Picture.tiff';
imwrite(I(:,:,i), file, 'WriteMode', 'append');
without quotes around the variable file.
  2 comentarios
Sebastian G
Sebastian G el 7 de Mzo. de 2013
My problem is that it does not record the extamente matrix.
I=round(rand(10,10,3)*10);
file='c:\temp\Picture.tiff';
for i=1:3
imwrite(I(:,:,i),file,'WriteMode','append');
end
thanks
Sebastian G
Sebastian G el 7 de Mzo. de 2013
My problem is that it does not record the same matrix. Sorry

Iniciar sesión para comentar.


Image Analyst
Image Analyst el 7 de Mzo. de 2013
Try the Tiff class. http://www.mathworks.com/help/matlab/ref/tiffclass.html I believe it has more and better functionality regarding tiff files. I've not used the WriteMode append option in imwrite(). But maybe Tiff is worth a try. I don't know what an "extamente" matrix is, but do you see the file size in bytes increase after each write? If so, that indicates that some data is being appended.
  5 comentarios
Image Analyst
Image Analyst el 7 de Mzo. de 2013
Can you also show the code you are using to read it back in and verify what was written out?
Sebastian G
Sebastian G el 8 de Mzo. de 2013
The problem was not divided by 255
I=round(rand(10,10,1)*10);
file='c:\temp\Picture.tiff';
I2=I./255;
imwrite(I2(:,:),file,'tiff');
I1(:,:)=imread(file,'tiff');
a=isequal(I,I1);
Thanks

Iniciar sesión para comentar.

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by