public void updateBackground ( MotionModel homeToCurrent , T frame ) { worldToHome . concat ( homeToCurrent , worldToCurrent ) ; worldToCurrent . invert ( currentToWorld ) ; // find the distorted polygon of the current image in the "home" background reference frame transform . setModel ( currentToWorld ) ; transform . compute ( 0 , 0 , corners [ 0 ] ) ; transform . compute ( frame . width - 1 , 0 , corners [ 1 ] ) ; transform . compute ( frame . width - 1 , frame . height - 1 , corners [ 2 ] ) ; transform . compute ( 0 , frame . height - 1 , corners [ 3 ] ) ; // find the bounding box int x0 = Integer . MAX_VALUE ; int y0 = Integer . MAX_VALUE ; int x1 = - Integer . MAX_VALUE ; int y1 = - Integer . MAX_VALUE ; for ( int i = 0 ; i < 4 ; i ++ ) { Point2D_F32 p = corners [ i ] ; int x = ( int ) p . x ; int y = ( int ) p . y ; if ( x0 > x ) x0 = x ; if ( y0 > y ) y0 = y ; if ( x1 < x ) x1 = x ; if ( y1 < y ) y1 = y ; } x1 ++ ; y1 ++ ; if ( x0 < 0 ) x0 = 0 ; if ( x1 > backgroundWidth ) x1 = backgroundWidth ; if ( y0 < 0 ) y0 = 0 ; if ( y1 > backgroundHeight ) y1 = backgroundHeight ; updateBackground ( x0 , y0 , x1 , y1 , frame ) ; }
Updates the background with new image information .