cyrildiagne / ofxCvCameraProjectorCalibration

OpenFrameworks addon that helps calibrating a camera and a projector using OpenCV

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

example-calibration crash after camera calibration

paul-ferragut opened this issue · comments

at the end of camera calibration I get an error OpenCV Error: Null pointer (Null pointer to reader or destination array) in cvReadRawDataSlice, file ......\modules\core\src\persistence.cpp line 3245

the crash is when the app is changing state from CAMERA to PROJECTOR_STATIC or when running in PROJECTOR_STATIC state with my cameraCalibration file , however if I try to run in PROJECTOR_STATIC state using your cameraCalibration file the app is not crashing. I might be doing something wrong in the camera calibration, please let me know if you have any suggestions, this addon looks awesome would love to manage to use it.
thanks

I faced the same problem and modified as follows to solve it.

In Calibration.cpp (in addons/ofxCv//libs/ofxCv/src), I changed
fs << "[:" << imagePoints[i] << "]";
to
fs << imagePoints[i];

If you use the code before modification, features was exported as follows in the calibrationCamera.yml.
features:
-[ [ 4.03665039e+02, 5.15171326e+02, 4.49520020e+02, 4.80329987e+02,
...
8.02705994e+02, 4.51542999e+02, 8.33743286e+02, 4.19411774e+02 ] ]
-[ [ 1.45415695e+02, 4.51887360e+02, 1.97437866e+02, 4.21586609e+02,
...
5.50285950e+02, 4.28862122e+02, 5.90773010e+02, 3.98728363e+02] ]

and if you use the code modified,
features:
-[ 4.03665039e+02, 5.15171326e+02, 4.49520020e+02, 4.80329987e+02,
...
8.02705994e+02, 4.51542999e+02, 8.33743286e+02, 4.19411774e+02 ]
-[ 1.45415695e+02, 4.51887360e+02, 1.97437866e+02, 4.21586609e+02,
...
5.50285950e+02, 4.28862122e+02, 5.90773010e+02, 3.98728363e+02]

commented

I faced the same problem and modified as follows to solve it.

In Calibration.cpp (in addons/ofxCv//libs/ofxCv/src), I changed
fs << "[:" << imagePoints[i] << "]";
to
fs << imagePoints[i];

If you use the code before modification, features was exported as follows in the calibrationCamera.yml.
features:
-[ [ 4.03665039e+02, 5.15171326e+02, 4.49520020e+02, 4.80329987e+02,
...
8.02705994e+02, 4.51542999e+02, 8.33743286e+02, 4.19411774e+02 ] ]
-[ [ 1.45415695e+02, 4.51887360e+02, 1.97437866e+02, 4.21586609e+02,
...
5.50285950e+02, 4.28862122e+02, 5.90773010e+02, 3.98728363e+02] ]

and if you use the code modified,
features:
-[ 4.03665039e+02, 5.15171326e+02, 4.49520020e+02, 4.80329987e+02,
...
8.02705994e+02, 4.51542999e+02, 8.33743286e+02, 4.19411774e+02 ]
-[ 1.45415695e+02, 4.51887360e+02, 1.97437866e+02, 4.21586609e+02,
...
5.50285950e+02, 4.28862122e+02, 5.90773010e+02, 3.98728363e+02]

Hi , since you had success to run the code. would you please tell me what are the steps to make it work?
Many regards