private SceneObservations createObservationsForBundleAdjustment ( LookupSimilarImages db , View seed , GrowQueue_I32 motions ) { // seed view + the motions SceneObservations observations = new SceneObservations ( motions . size + 1 ) ; // Observations for the seed view are a special case SceneObservations . View obsView = observations . getView ( 0 ) ; for ( int i = 0 ; i < inlierToSeed . size ; i ++ ) { int id = inlierToSeed . data [ i ] ; Point2D_F64 o = featsA . get ( id ) ; // featsA is never modified after initially loaded id = seedToStructure . data [ id ] ; obsView . add ( id , ( float ) o . x , ( float ) o . y ) ; } // Now add observations for edges connected to the seed for ( int i = 0 ; i < motions . size ( ) ; i ++ ) { obsView = observations . getView ( i + 1 ) ; Motion m = seed . connections . get ( motions . get ( i ) ) ; View v = m . other ( seed ) ; boolean seedIsSrc = m . src == seed ; db . lookupPixelFeats ( v . id , featsB ) ; for ( int j = 0 ; j < m . inliers . size ; j ++ ) { AssociatedIndex a = m . inliers . get ( j ) ; int id = seedToStructure . data [ seedIsSrc ? a . src : a . dst ] ; if ( id < 0 ) continue ; Point2D_F64 o = featsB . get ( seedIsSrc ? a . dst : a . src ) ; obsView . add ( id , ( float ) o . x , ( float ) o . y ) ; } } return observations ; }
Convert observations into a format which bundle adjustment will understand