Dear Opencv'rs
I have been able to compile and execute every sample I have touched from the opencv 4.1.1 samples folder, including camera_calibration.
Now, with real_time_pose_etimation I have been facing a sturbon compiling issue -unsuccesfully troubleshooted it for days- so I must kindly ask for your help.
Opencv 4.1.1 Windows 10 Pro, have tried building both x86 and x64 VS 2019, ver 16.3.5 Code: C:\opencv\sources\samples\cpp\tutorial_code\calib3d\real_time_pose_estimation\src
What I usually do -not a cmaker user- is I CTRL+V into a new project source file the main cpp content and copy all the reamining .cpp and .h files to the include/opencv2.
In the case of real_time_pose_estimation I brought a copy of main_detection.cpp as my project main source. Everything else I've dumped into my local "..include/opencv2". I have copied the data folder to my project forlder. This is the way you -I succesfully have- build opencv modules (apps) in VS-c++.
All my include lines seem to be okay, as well as the access to files (as per the path environment var and project configurations require).
When I try to compile, I am getting 36 warnings -27 errors- most of which refer to type operator overflowing after regular math operations. There are many cpp libraries throwing the warnings, but just one line -which I believe and hoped- from the main_detection.cpp line 351 (in my VS editor)
int startX = (int)((widthSave - frame_vis.cols) / 2.0);
The warning(s) I am getting
Warning C26451 Arithmetic overflow: Using operator '-' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '-' to avoid overflow (io.2)
I have looked for it in all available forums, which led me to try "Casting" in varies ways (one by one, and all possible combinations) the 3 operands in that line to make sure they are 8 byte values. I can not get out of this hole!.. sometimes I can bypass this line, particularly when I used
int startX = (int)(( intptr_t(widthSave) - intptr_t(frame_vis.cols)) / intptr_t(2.0));
then I get 'just' 35 Warnings, meaning the other .cpp libraries 'involved', keep comming back with the same
Warning C26451: Arithmetic overflow...
Thanks for your feedback