Filter löschen
Filter löschen

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

15 Ansichten (letzte 30 Tage)
zbingos
zbingos am 20 Dez. 2021
Kommentiert: yanqi liu am 21 Dez. 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 Kommentare
Matt J
Matt J am 20 Dez. 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 am 20 Dez. 2021
Imwrite and imread. I am trying now to follow Walter and Liu answers by setting correctly the tags in Geotiff.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

yanqi liu
yanqi liu am 20 Dez. 2021
yes,sir,may be use TIFF object,such as
t = Tiff('myfile.tif','w');
write(t,your_image_data);
close(t);
  3 Kommentare
yanqi liu
yanqi liu am 21 Dez. 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
>>

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

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

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by