フィルターのクリア

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

15 ビュー (過去 30 日間)
zbingos
zbingos 2021 年 12 月 20 日
コメント済み: yanqi liu 2021 年 12 月 21 日
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 件のコメント
Matt J
Matt J 2021 年 12 月 20 日
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 2021 年 12 月 20 日
Imwrite and imread. I am trying now to follow Walter and Liu answers by setting correctly the tags in Geotiff.

サインインしてコメントする。

採用された回答

yanqi liu
yanqi liu 2021 年 12 月 20 日
yes,sir,may be use TIFF object,such as
t = Tiff('myfile.tif','w');
write(t,your_image_data);
close(t);
  3 件のコメント
zbingos
zbingos 2021 年 12 月 20 日
Thanks
yanqi liu
yanqi liu 2021 年 12 月 21 日
@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
>>

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2021 年 12 月 20 日
imread can read bigtiff. imwrite cannot write bigtiff. The link above shows how to write bigtiff.
  2 件のコメント
zbingos
zbingos 2021 年 12 月 20 日
Thanks
Matt J
Matt J 2021 年 12 月 20 日
@zbingos you shoudl accept-click the answer that solves your problem.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImage Data についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by