Borrar filtros
Borrar filtros

Images must contain fewer than 2^32 - 1 bytes of data

15 visualizaciones (últimos 30 días)
zbingos
zbingos el 20 de Dic. de 2021
Comentada: yanqi liu el 21 de Dic. de 2021
I want to combine two images, with the following characteristics:
A: r,c = 51200,38497 uint16
B: r,c = 41505,38497 uint16
into
C: r,c = 92705,38497 uint16
The problem is that when I am trying to save it is not possible due to the following error:
Images must contain fewer than 2^32 - 1 bytes of data.
In addition, a strange thing is that if it is not possible to write C as a tif in 16bits why it is possible to read an image with the similar rows and collumns of C matrix?
Any ideas about the saving step?
  2 comentarios
Matt J
Matt J el 20 de Dic. de 2021
when I am trying to save it is not possible due to the following error:
What code did you use to save?
if it is not possible to write C as a tif in 16bits why it is possible to read an image with the similar rows and collumns
How do you know it is? What code did you use to read?
zbingos
zbingos el 20 de Dic. de 2021
Imwrite and imread. I am trying now to follow Walter and Liu answers by setting correctly the tags in Geotiff.

Iniciar sesión para comentar.

Respuesta aceptada

yanqi liu
yanqi liu el 20 de Dic. de 2021
yes,sir,may be use TIFF object,such as
t = Tiff('myfile.tif','w');
write(t,your_image_data);
close(t);
  3 comentarios
yanqi liu
yanqi liu el 21 de Dic. de 2021
@Walter Roberson yes,sir,it is important on configure tiff writer,thanks
@zbingos may be use an example,such as
clc; clear all; close all;
% configure tiff
t = Tiff('myfile.tif','w8');
setTag(t,'ImageLength',10);
setTag(t,'ImageWidth',10);
setTag(t,'Photometric',Tiff.Photometric.RGB);
setTag(t,'PlanarConfiguration',Tiff.PlanarConfiguration.Chunky);
setTag(t,'BitsPerSample',16);
setTag(t,'SamplesPerPixel',3);
% make data
your_image_data = uint16(ones(10,10,3));
your_image_data(1,1,1:3) = 2^32 - 1;
% write data
write(t,your_image_data);
close(t);
% read and display
a = imread('myfile.tif');
a(1,1,1)
>> a(1,1,1)
ans =
uint16
65535
>>

Iniciar sesión para comentar.

Más respuestas (1)

Walter Roberson
Walter Roberson el 20 de Dic. de 2021
imread can read bigtiff. imwrite cannot write bigtiff. The link above shows how to write bigtiff.
  2 comentarios
Matt J
Matt J el 20 de Dic. de 2021
@zbingos you shoudl accept-click the answer that solves your problem.

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by