OpenCV and Numpy interacting badly
This isn't an answer, but it's too big for a comment. I played with the values a bit to find the limits.
Without loading numpy
and cv
:
>>> unpack("f", pack("i", 8388608))(1.1754943508222875e-38,)>>> unpack("f", pack("i", 8388607))(1.1754942106924411e-38,)
After loading numpy
and cv
, the first line is the same, but the second:
>>> unpack("f", pack("i", 8388607))(0.0,)
You'll notice that the first result is the lower limit for 32 bit floats. I then tried the same with d
.
Without loading the libraries:
>>> unpack("d", pack("xi", 1048576))(2.2250738585072014e-308,)>>> unpack("d", pack("xi", 1048575))(2.2250717365114104e-308,)
And after loading the libraries:
>>> unpack("d",pack("xi", 1048575))(0.0,)
Now the first result is the lower limit for 64 bit float precision.
It seems that for some reason, loading the numpy
and cv
libraries, in that order, constrains unpack
to use 32 and 64 bit precision and return 0 for lower values.