Python wrapper warning for win64 platform (Bug #4311)
Description
Hi all,
i try to push python support for module opencv_contrib/biosinspired.
The win64 builder returns the following warning that do not target my c++ code but the python wrapper part.
@ 210>C:\builds_ocv\precommit-contrib_windows64\build\modules\python2\pyopencv_generated_types.h(16079): warning C4305: 'initializing' : truncation from 'double' to 'float' [C:\builds_ocv\precommit-contrib_windows64\build\modules\python2\opencv_python2.vcxproj]
210>C:\builds_ocv\precommit-contrib_windows64\build\modules\python2\pyopencv_generated_types.h(16080): warning C4305: 'initializing' : truncation from 'double' to 'float' [C:\builds_ocv\precommit-contrib_windows64\build\modules\python2\opencv_python2.vcxproj]
210>C:\builds_ocv\precommit-contrib_windows64\build\modules\python2\pyopencv_generated_types.h(16103): warning C4305: 'initializing' : truncation from 'double' to 'float' [C:\builds_ocv\precommit-contrib_windows64\build\modules\python2\opencv_python2.vcxproj]
210>C:\builds_ocv\precommit-contrib_windows64\build\modules\python2\pyopencv_generated_types.h(16105): warning C4305: 'initializing' : truncation from 'double' to 'float' [C:\builds_ocv\precommit-contrib_windows64\build\modules\python2\opencv_python2.vcxproj]
210>C:\builds_ocv\precommit-contrib_windows64\build\modules\python2\pyopencv_generated_types.h(16109): warning C4305: 'initializing' : truncation from 'double' to 'float' [C:\builds_ocv\precommit-contrib_windows64\build\modules\python2\opencv_python2.vcxproj]
@
This can be a consequence of an ill formed coding on my side but it is difficult to locate it with those warnings and it only appears on one platform.
Then, do those warning MUST be solved, if yes, how to find them ? If not, i guess i can merge... ?
Thanks
History
Updated by Steven Puttemans almost 10 years ago
Well it will not get merged as long as the warnings are not good. Could you just upload the following file to this bug issue?
builds_ocv\precommit-contrib_windows64\build\modules\python2\pyopencv_generated_types.h
I dont got a valid python build around, but the file might identify where it goes wrong. We need to know which type is yielding the error.
Updated by be rak almost 10 years ago
i tried your pr, and there are indeed some cases where, e.g:
CV_WRAP virtual void setColorSaturation(const bool saturateColors=true, const float colorSaturationValue=4.0)=0;
will get wrapped to:
@
static PyObject* pyopencv_cv_bioinspired_bioinspired_Retina_setColorSaturation(PyObject* self, PyObject* args, PyObject* kw)
{
using namespace cv::bioinspired;
if(!PyObject_TypeCheck(self, &pyopencv_bioinspired_Retina_Type))
return failmsgp("Incorrect type of self (must be 'bioinspired_Retina' or its derivative)");
cv::bioinspired::Retina* self = dynamic_cast<cv::bioinspired::Retina*>(((pyopencv_bioinspired_Retina_t*)self)->v.get());
bool saturateColors=true;
float colorSaturationValue=4.0;
...
@
(no idea though, why it only complains about the python wrapper)
Updated by Alexandre Benoit almost 10 years ago
Hi, thank you for your answers.
Well, i have no idea what to do in the code to avoid the warning. The Python wrapper is new to me.
If anybody has an idea...
One option could be to deactivate the wrapping of this function but it is a silly way.
Thank you.
Updated by be rak almost 10 years ago
avoid the truncation by giving it a float suffix, maybe ?
CV_WRAP virtual void setColorSaturation(const bool saturateColors=true, const float colorSaturationValue=4.0f)=0;
Updated by Alexandre Benoit almost 10 years ago
Just tested this, but it did not remove the warning, however, there are other places in the code that should get this type of change. I gonna do it soon.
Then, just a stupid question, how to get the files that have been generated on the build farm (typically here to get file C:\builds_ocv\precommit-contrib_windows64\build\modules\python2\pyopencv_generated_types.h
Thanks
Updated by Alexandre Benoit almost 10 years ago
Hi,
well, after an addition of float suffix 'f' on all default float hard coded values, it seems that it is now ok.
Thank you for the suggestion.
the build farm is all green now, I merge the related pull request.
Thanks
Updated by Alexandre Benoit almost 10 years ago
Hi all,
pull request is now all green on the build farm.
Who can do the final step (review/merge) ?
thanks.
Updated by Steven Puttemans almost 10 years ago
Now you will have to be patient and give the core developers some time to take a look at it and see if they agree with your fixes!
Updated by Alexander Alekhin almost 10 years ago
- Status changed from New to Done
- % Done changed from 0 to 100