Warning messages when building OpenCV with opencv_contrib

Hi! I want to build OpenCV with opencv_contrib for Android. I’m using this guide. But when I write make, I get such errors:

E:\OpenCV\opencv\3rdparty\carotene\src\div.cpp:161:19: warning: implicit conversion from
      'std::numeric_limits<int>::type' (aka 'int') to 'float' changes value from 2147483647 to 2147483648
      [-Wimplicit-const-int-float-conversion]
         (scale * std::numeric_limits<T>::max()) > -1.0f))
                ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
E:\OpenCV\opencv\3rdparty\carotene\src\div.cpp:453:5: note: in instantiation of function template specialization
      'carotene_o4t::(anonymous namespace)::div<int>' requested here
    div<s32>(size, src0Base, src0Stride, src1Base, src1Stride, dstBase, dstStride, scale, cpolicy);
    ^
E:\OpenCV\opencv\3rdparty\carotene\src\div.cpp:160:19: warning: implicit conversion from
      'std::numeric_limits<int>::type' (aka 'int') to 'float' changes value from 2147483647 to 2147483648
      [-Wimplicit-const-int-float-conversion]
         (scale * std::numeric_limits<T>::max()) <  1.0f &&
                ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.

Is this normal? If not, how can I fix it?

you could try disabling the build of tests. dig around in the cmake gui to find the right variables.

you should edit your post, replace the picture with the text it contains. makes the question findable by others.

I tried to disable build of: tests, Android projects, Android examples, but I still get warnings(I replaced the photo with just this warnings)

ignore the warnings. there are always a ton of warnings when building huge projects. nobody has time to worry about the little things.

in that case, whoever wrote the code probably didn’t worry particularly about value ranges.

you could file an issue about it, unless that already exists.

1 Like