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