using copied version of solvePnPRansac for OpencV 3.3.1 too (along OpenCV2) to have stable transformation estimation (e.g., outdoor stereo demo is getting lost very often with the version of 3.3.1)

This commit is contained in:
matlabbe
2018-04-30 17:44:13 -04:00
parent 8fec570c13
commit 52aed1041c
2 changed files with 8 additions and 8 deletions

View File

@@ -96,9 +96,12 @@ IF(OpenCV_VERSION_MAJOR EQUAL 2)
SET(SRC_FILES
${SRC_FILES}
opencv/Orb.cpp
opencv/solvepnp.cpp
)
ENDIF(OpenCV_VERSION_MAJOR EQUAL 2)
SET(SRC_FILES
${SRC_FILES}
opencv/solvepnp.cpp
)
# to get includes in visual studio
IF(MSVC)

View File

@@ -37,9 +37,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <pcl/common/common.h>
#if CV_MAJOR_VERSION < 3
#include "opencv/solvepnp.h"
#endif
namespace rtabmap
{
@@ -344,11 +342,10 @@ void solvePnPRansac(
{
minInliersCount = 4;
}
#if CV_MAJOR_VERSION < 3
cv3::solvePnPRansac( //use OpenCV3 version of solvePnPRansac in OpenCV2
#else
cv::solvePnPRansac( // use directly version from OpenCV 3
#endif
// Use OpenCV3 version of solvePnPRansac in OpenCV2.
// FIXME: we should use this version of solvePnPRansac in newer 3.3.1 too, which seems a lot less stable!?!? Why!?
cv3::solvePnPRansac(
objectPoints,
imagePoints,
cameraMatrix,