Error using containers.Map in matlab 2015a

1 回表示 (過去 30 日間)
Rupok Kumar
Rupok Kumar 2018 年 5 月 15 日
コメント済み: Guillaume 2018 年 5 月 15 日
I have got this error. Here i attached my code:
image = hdrread('Apartment_float_o15C.hdr');
[h,w,~] = size(image);
uint16_image = to_16_bit(image);
keys = unique(uint16_image);
[num_keys, ~] = size(keys);
values = (0:1:num_keys-1).';
map = containers.Map(keys, values);
inverse_map = containers.Map(values, keys);
%uint16_image_mapped = image2MappedImage(uint16_image, map);
%uint16_image_reversed = image2MappedImage(uint16_image_mapped, inverse_map);
image_mapped = to_single(uint16_image_mapped);
figure
histo = histogram(uint16_image,'BinWidth',1)
figure
mapped_histo = histogram(uint16_image_mapped,'BinWidth',1)
figure
reversed_histo = histogram(uint16_image_reversed,'BinWidth',1)
figure
imshow( tonemap(image_mapped), []);
result = image2MappedImage(uint16_image, map);
result = to_16_bit(image);
result = to_single(image);
result = getBinCounts(histo);
The error is here:
Error in hdr_OpenEXR_format (line 12)
map = containers.Map(keys, values);
can anyone help me out of this? Thanks in advance
  3 件のコメント
Rupok Kumar
Rupok Kumar 2018 年 5 月 15 日
編集済み: Rupok Kumar 2018 年 5 月 15 日
It works in R2018a but not working in my version which is R2015a. The error shoes that:
Error using containers.Map
NaN-valued key is not allowed for this container.
Error in hdr_OpenEXR_format (line 12)
map = containers.Map(keys, values);
What i need to change, could you help me please?
Guillaume
Guillaume 2018 年 5 月 15 日
What does
any(isnan(keys))
return?

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

回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by