Clear Filters
Clear Filters

Error using containers.Map in matlab 2015a

4 views (last 30 days)
Rupok Kumar
Rupok Kumar on 15 May 2018
Commented: Guillaume on 15 May 2018
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 Comments
Rupok Kumar
Rupok Kumar on 15 May 2018
Edited: Rupok Kumar on 15 May 2018
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?

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!