Tiff library to export Tiff image uint32

I don't know how exactly to use the tifflib code given by matlab. I have a uint32 image J on matlab and i want to export it in tiff. can anyone tell me how?

3 comentarios

Rik
Rik el 2 de Jul. de 2018
Have a read here and here. Explain what you have tried so far. Show the code.
Have you read the documentation for write?
this is the image that i have on matlab:
J= imopen(I,SE);
this is the code i used
t = Tiff(filename, 'w');
tagstruct.ImageLength = size(A, 1);
tagstruct.ImageWidth = size(A, 2);
tagstruct.Compression = Tiff.Compression.None;
tagstruct.SampleFormat = Tiff.SampleFormat.IEEEFP;
tagstruct.Photometric = Tiff.Photometric.MinIsBlack;
tagstruct.BitsPerSample = 32;
tagstruct.SamplesPerPixel = 1;
tagstruct.PlanarConfiguration = Tiff.PlanarConfiguration.Chunky;
t.setTag(tagstruct);
t.write(A);
t.close();
tagstruct.SampleFormat = Tiff.SampleFormat.Uint;

Iniciar sesión para comentar.

Respuestas (2)

Mirett Boliard
Mirett Boliard el 2 de Jul. de 2018

0 votos

can anyone help please

1 comentario

Rik
Rik el 2 de Jul. de 2018
Why the impatience? It has only been 20 minutes since you posted the question. People in Europe are probably sleeping or going to sleep, and the US/Canada are still in office hours. For most contributors this is something for their spare time. If you need answers this fast, consider hiring a consultant.
Also, this is not answer. Please only post an answer if you actually solve the question you posed.

Iniciar sesión para comentar.

Rik
Rik el 2 de Jul. de 2018
I generated an example with the line below
A=uint32(randi(uint32(inf),255,255));
Then, running your code resulted in this error:
If SampleFormat is IEEEFP, the image datatype is restricted
to one of the following: single, double.
So your choice of format is incompatible with your choice of input data type. There are two ways to fix this:
  1. Set tagstruct.SampleFormat = Tiff.SampleFormat.Uint;
  2. Cast your data to the single datatype with A=single(A);.

1 comentario

Rik
Rik el 3 de Jul. de 2018
Did this suggestion solve your problem? If so, please consider marking it as accepted answer. It will make it easier for other people with the same question to find an answer. If this didn't solve your question, please comment with what problems you are still having.

Iniciar sesión para comentar.

Categorías

Más información sobre Programming en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 2 de Jul. de 2018

Comentada:

Rik
el 3 de Jul. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by