From d3ba3326918e3a2ef001fcf7736f04fdf0850662 Mon Sep 17 00:00:00 2001 From: Louise Poubel Date: Wed, 29 May 2019 13:25:49 -0700 Subject: [PATCH] Ignore special conditions when normalizing image --- src/rviz/image/ros_image_texture.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/rviz/image/ros_image_texture.cpp b/src/rviz/image/ros_image_texture.cpp index f694622298..6cd5f3aab4 100644 --- a/src/rviz/image/ros_image_texture.cpp +++ b/src/rviz/image/ros_image_texture.cpp @@ -127,6 +127,14 @@ void ROSImageTexture::normalize( T* image_data, size_t image_data_size, std::vec maxValue = std::numeric_limits::min(); for( unsigned i = 0; i < image_data_size; ++i ) { + if (*input_ptr == std::numeric_limits::infinity() || + *input_ptr == -std::numeric_limits::infinity() || + *input_ptr == std::numeric_limits::quiet_NaN()) + { + input_ptr++; + continue; + } + minValue = std::min( minValue, *input_ptr ); maxValue = std::max( maxValue, *input_ptr ); input_ptr++;