diff --git a/dlib/image_transforms/colormaps.h b/dlib/image_transforms/colormaps.h index 40d9c335c..258aaf3cb 100644 --- a/dlib/image_transforms/colormaps.h +++ b/dlib/image_transforms/colormaps.h @@ -145,7 +145,10 @@ namespace dlib ) { typedef op_heatmap op; - return matrix_op(op(img,max(mat(img)),min(mat(img)))); + if (img.size() != 0) + return matrix_op(op(img,max(mat(img)),min(mat(img)))); + else + return matrix_op(op(img,0,0)); } // ---------------------------------------------------------------------------------------- @@ -252,7 +255,10 @@ namespace dlib ) { typedef op_jet op; - return matrix_op(op(img,max(mat(img)),min(mat(img)))); + if (img.size() != 0) + return matrix_op(op(img,max(mat(img)),min(mat(img)))); + else + return matrix_op(op(img,0,0)); } // ----------------------------------------------------------------------------------------