Effacer les filtres
Effacer les filtres

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

15 vues (au cours des 30 derniers jours)
zbingos
zbingos le 20 Déc 2021
Commenté : yanqi liu le 21 Déc 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 commentaires
Matt J
Matt J le 20 Déc 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 le 20 Déc 2021
Imwrite and imread. I am trying now to follow Walter and Liu answers by setting correctly the tags in Geotiff.

Connectez-vous pour commenter.

Réponse acceptée

yanqi liu
yanqi liu le 20 Déc 2021
yes,sir,may be use TIFF object,such as
t = Tiff('myfile.tif','w');
write(t,your_image_data);
close(t);
  3 commentaires
zbingos
zbingos le 20 Déc 2021
Thanks
yanqi liu
yanqi liu le 21 Déc 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
>>

Connectez-vous pour commenter.

Plus de réponses (1)

Walter Roberson
Walter Roberson le 20 Déc 2021
imread can read bigtiff. imwrite cannot write bigtiff. The link above shows how to write bigtiff.
  2 commentaires
zbingos
zbingos le 20 Déc 2021
Thanks
Matt J
Matt J le 20 Déc 2021
@zbingos you shoudl accept-click the answer that solves your problem.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by