boolean findRemainingCameraMatrices ( LookupSimilarImages db , View seed , GrowQueue_I32 motions ) { points3D . reset ( ) ; // points in 3D for ( int i = 0 ; i < structure . points . length ; i ++ ) { structure . points [ i ] . get ( points3D . grow ( ) ) ; } // contains associated pairs of pixel observations // save a call to db by using the previously loaded points assocPixel . reset ( ) ; for ( int i = 0 ; i < inlierToSeed . size ; i ++ ) { // inliers from triple RANSAC // each of these inliers was declared a feature in the world reference frame assocPixel . grow ( ) . p1 . set ( matchesTriple . get ( i ) . p1 ) ; } DMatrixRMaj cameraMatrix = new DMatrixRMaj ( 3 , 4 ) ; for ( int motionIdx = 0 ; motionIdx < motions . size ; motionIdx ++ ) { // skip views already in the scene's structure if ( motionIdx == selectedTriple [ 0 ] || motionIdx == selectedTriple [ 1 ] ) continue ; int connectionIdx = motions . get ( motionIdx ) ; Motion edge = seed . connections . get ( connectionIdx ) ; View viewI = edge . other ( seed ) ; // Lookup pixel locations of features in the connected view db . lookupPixelFeats ( viewI . id , featsB ) ; if ( ! computeCameraMatrix ( seed , edge , featsB , cameraMatrix ) ) { if ( verbose != null ) { verbose . println ( "Pose estimator failed! motionIdx=" + motionIdx ) ; } return false ; } db . lookupShape ( edge . other ( seed ) . id , shape ) ; structure . setView ( motionIdx , false , cameraMatrix , shape . width , shape . height ) ; } return true ; }
Uses the triangulated points and observations in the root view to estimate the camera matrix for all the views which are remaining