Error using containers.Map in matlab 2015a

4 次查看(过去 30 天)
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?

请先登录,再进行评论。

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by