Skip to content

Commit

Permalink
Fix wrong feature points in extractFeaturesKLT()
Browse files Browse the repository at this point in the history
(Fixes #138)
  • Loading branch information
jlblancoc committed Jul 13, 2015
1 parent f436450 commit 74b5df4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
1 change: 1 addition & 0 deletions doc/doxygen-pages/changeLog_doc.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
- Fix wrong quaternion cross product when target variable is one of the operands. Also affected the += operator of mrpt::poses::CPose3DQuat (Fixes #148)
- mrpt::hwdrivers::CKinect with libfreenect driver: Fix potential memory corruption.
- Fix a bug in mrpt::tfest::se3_l2_robust() that led to it returning without trying to find a good consensus solution. It affected the demo app kinect-3d-slam (Fixes #156)
- Fix wrong feature points in CFeatureExtraction::extractFeaturesKLT() (Fixes #138)
<hr>
<a name="1.3.0">
Expand Down
20 changes: 4 additions & 16 deletions libs/vision/src/CFeatureExtraction_harris_KLT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,27 +61,15 @@ void CFeatureExtraction::extractFeaturesKLT(

nDesiredFeatures <= 0 ? nPts = MAX_COUNT : nPts = nDesiredFeatures;

std::vector<CvPoint2D32f> points(nPts);

//CvImage eig, temp; // temporary and auxiliary images

#ifdef VERBOSE_TIMING
tictac.Tic();
#endif
//eig.create( cvGetSize( cGrey ), 32, 1 );
//temp.create( cvGetSize( cGrey ), 32, 1 );

#ifdef VERBOSE_TIMING
cout << "[KLT] Create: " << tictac.Tac()*1000.0f << endl;
#endif
count = nPts; // Number of points to find


#if 0 // Temporary debug
{
static int i=0;
cvSaveImage( format("debug_map_%05i.bmp",++i).c_str(), cGrey);
}
#endif
// -----------------------------------------------------------------
// Select good features with subpixel accuracy (USING HARRIS OR KLT)
// -----------------------------------------------------------------
Expand All @@ -90,9 +78,9 @@ void CFeatureExtraction::extractFeaturesKLT(
#ifdef VERBOSE_TIMING
tictac.Tic();
#endif
std::vector<cv::Point2f> corners;
std::vector<cv::Point2f> points;
cv::goodFeaturesToTrack(
cGrey,corners, nPts,
cGrey,points, nPts,
(double)options.harrisOptions.threshold, // for rejecting weak local maxima ( with min_eig < threshold*max(eig_image) )
(double)options.harrisOptions.min_distance, // minimum distance between features
cv::noArray(), // mask
Expand All @@ -113,7 +101,7 @@ void CFeatureExtraction::extractFeaturesKLT(
tictac.Tic();
#endif
// Subpixel interpolation
cv::cornerSubPix(cGrey,corners,
cv::cornerSubPix(cGrey,points,
cv::Size(3,3), cv::Size(-1,-1),
cv::TermCriteria( CV_TERMCRIT_ITER|CV_TERMCRIT_EPS, 10, 0.05 ));

Expand Down

0 comments on commit 74b5df4

Please sign in to comment.