diff --git a/dlib/image_transforms/segment_image.h b/dlib/image_transforms/segment_image.h index f8574a36c..217ebb70b 100644 --- a/dlib/image_transforms/segment_image.h +++ b/dlib/image_transforms/segment_image.h @@ -483,8 +483,8 @@ namespace dlib if (set1 != set2) { const diff_type diff = sorted_edges[i].diff; - const diff_type tau1 = k/data[set1].component_size; - const diff_type tau2 = k/data[set2].component_size; + const diff_type tau1 = static_cast(k/data[set1].component_size); + const diff_type tau2 = static_cast(k/data[set2].component_size); const diff_type mint = std::min(data[set1].internal_diff + tau1, data[set2].internal_diff + tau2); diff --git a/dlib/test/object_detector.cpp b/dlib/test/object_detector.cpp index 26c25d68d..d922a51c8 100644 --- a/dlib/test/object_detector.cpp +++ b/dlib/test/object_detector.cpp @@ -258,7 +258,9 @@ namespace { for (long c = 0; c < images[i].nc(); ++c) { - images[i][r][c] = put_in_range(0,255,images[i][r][c] + 10*rnd.get_random_gaussian()); + typedef typename image_array_type::type image_type; + typedef typename image_type::type type; + images[i][r][c] = (type)put_in_range(0,255,images[i][r][c] + 10*rnd.get_random_gaussian()); } } } @@ -356,7 +358,9 @@ namespace { for (long c = 0; c < images[i].nc(); ++c) { - images[i][r][c] = put_in_range(0,255,images[i][r][c] + 40*rnd.get_random_gaussian()); + typedef typename image_array_type::type image_type; + typedef typename image_type::type type; + images[i][r][c] = (type)put_in_range(0,255,images[i][r][c] + 40*rnd.get_random_gaussian()); } } }