[SOLVED] ar-detector : the program crash when it detects the marker
Posted: Thu Aug 18, 2016 12:31 pm
I everybody !
I'm using xubuntu 16.04 (no vm).
I'm trying to make the crazyflie-ar-detector works (github : https://github.com/bitcraze/crazyflie-ar-detector) . I was able to calibrate my camera with the program "calibrate_camera_charuco" from opencv_contrib.
Moreover, the program "detect_markers" from opencv_contrib is perfectly working.
The program made by bitcraze is based on the program "detect_markers" form opencv_contrib :
opencv_contrib program https://github.com/opencv/opencv_contri ... arkers.cpp
bitcraze program https://github.com/bitcraze/crazyflie-a ... arkers.cpp
I've compiled the program "detect_markers" made by bitcraze, and it works if it doesn't detect any marker. But when it detects a marker (e.g. when I place the marker in front of the camera), the program stop working.
I get this error :
In the while loop, the vectors rvecs and tvecs are not the same type.
bitcraze version (line 284) :
opencv_contrib version (line 177) :
I think that the method used here (line 289) :
has been changed since the release of the code by bitcraze.
With the original code form bitcraze I can compile and the program works until the method estimatePoseSingleMarkers(...) is called.
But if I changed the type of vector, I can't compile the program because of these lines (line 346) :
If tvecs is a vector<Vec3d>, the method .at can't be used.
To be sure of that, I've commented these lines and I was able to compile. Moreover the program detected the marker but with a position equal to (0,0,0) of course, because pos_x, pos_y and pos_z weren't changed.
A solution to this problem would be to install an older version of openCV3.
But it would be better to correct this problem !
Do you have any clue about this problem?
If you think that my problem is badly expressed, just ask me to rephrase or to add information.
Thanks,
Pierre
I'm using xubuntu 16.04 (no vm).
I'm trying to make the crazyflie-ar-detector works (github : https://github.com/bitcraze/crazyflie-ar-detector) . I was able to calibrate my camera with the program "calibrate_camera_charuco" from opencv_contrib.
Moreover, the program "detect_markers" from opencv_contrib is perfectly working.
The program made by bitcraze is based on the program "detect_markers" form opencv_contrib :
opencv_contrib program https://github.com/opencv/opencv_contri ... arkers.cpp
bitcraze program https://github.com/bitcraze/crazyflie-a ... arkers.cpp
I've compiled the program "detect_markers" made by bitcraze, and it works if it doesn't detect any marker. But when it detects a marker (e.g. when I place the marker in front of the camera), the program stop working.
I get this error :
I searched a lot, and by comparing the code from the bitcraze program and the code from opencv_contrib, I noticed a change :OpenCV Error: Assertion failed (0 <= i && i < (int)v.size()) in getMat_, file /home/pierre/projects/opencv/modules/core/src/matrix.cpp, line 1201
terminate called after throwing an instance of 'cv::Exception'
what(): /home/pierre/projects/opencv/modules/core/src/matrix.cpp:1201: error: (-215) 0 <= i && i < (int)v.size() in function getMat_
Abandon (core dumped)
In the while loop, the vectors rvecs and tvecs are not the same type.
bitcraze version (line 284) :
Code: Select all
vector< Mat > rvecs, tvecs;
Code: Select all
vector< Vec3d > rvecs, tvecs;
Code: Select all
aruco::estimatePoseSingleMarkers(corners, markerLength, camMatrix, distCoeffs, rvecs,
tvecs);
With the original code form bitcraze I can compile and the program works until the method estimatePoseSingleMarkers(...) is called.
But if I changed the type of vector, I can't compile the program because of these lines (line 346) :
Code: Select all
pos_x = tvecs[0].at<double>(0);
pos_y = tvecs[0].at<double>(1);
pos_z = tvecs[0].at<double>(2);
To be sure of that, I've commented these lines and I was able to compile. Moreover the program detected the marker but with a position equal to (0,0,0) of course, because pos_x, pos_y and pos_z weren't changed.
A solution to this problem would be to install an older version of openCV3.
But it would be better to correct this problem !
Do you have any clue about this problem?
If you think that my problem is badly expressed, just ask me to rephrase or to add information.
Thanks,
Pierre