void setKeyFrame ( Planar < I > input , ImagePixelTo3D pixelTo3D ) { InputSanityCheck . checkSameShape ( derivX , input ) ; wrapI . wrap ( input ) ; keypixels . reset ( ) ; for ( int y = 0 ; y < input . height ; y ++ ) { for ( int x = 0 ; x < input . width ; x ++ ) { // See if there's a valid 3D point at this location if ( ! pixelTo3D . process ( x , y ) ) { continue ; } float P_x = ( float ) pixelTo3D . getX ( ) ; float P_y = ( float ) pixelTo3D . getY ( ) ; float P_z = ( float ) pixelTo3D . getZ ( ) ; float P_w = ( float ) pixelTo3D . getW ( ) ; // skip point if it's at infinity or has a negative value if ( P_w <= 0 ) continue ; // save the results Pixel p = keypixels . grow ( ) ; p . valid = true ; wrapI . get ( x , y , p . bands ) ; p . x = x ; p . y = y ; p . p3 . set ( P_x / P_w , P_y / P_w , P_z / P_w ) ; } } }
Set s the keyframe . This is the image which motion is estimated relative to . The 3D location of points in the keyframe must be known .