Skip to content
Snippets Groups Projects
Commit eaee7fcf authored by calrama's avatar calrama
Browse files

Fix a crash when image to display is completely black

parent 4291ea2d
Branches
No related tags found
No related merge requests found
Pipeline #42289 passed
......@@ -24,7 +24,7 @@ void TextureObject::set(const cv::Mat &img) {
// (usually 64F) so we need to map a [HUGE range] to -> [0 .. 255]
double min, max;
cv::minMaxLoc(img, &min, &max);
if (min >= 0 && min < 255 && max > 0 && max <= 255) {
if (min >= 0 && min < 255 && max >= 0 && max <= 255) {
// do not refit if the range is actually inbetween [0 ... 255]
img.convertTo(img8U, CV_8U);
} else if (max > min) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment