private void rectifyInputImages ( ) { // get intrinsic camera calibration matrices DMatrixRMaj K1 = PerspectiveOps . pinholeToMatrix ( calib . left , ( DMatrixRMaj ) null ) ; DMatrixRMaj K2 = PerspectiveOps . pinholeToMatrix ( calib . right , ( DMatrixRMaj ) null ) ; // compute rectification matrices rectifyAlg . process ( K1 , new Se3_F64 ( ) , K2 , calib . getRightToLeft ( ) . invert ( null ) ) ; DMatrixRMaj rect1 = rectifyAlg . getRect1 ( ) ; DMatrixRMaj rect2 = rectifyAlg . getRect2 ( ) ; rectK = rectifyAlg . getCalibrationMatrix ( ) ; rectR = rectifyAlg . getRectifiedRotation ( ) ; // adjust view to maximize viewing area while not including black regions RectifyImageOps . allInsideLeft ( calib . left , rect1 , rect2 , rectK ) ; // compute transforms to apply rectify the images leftRectToPixel = transformRectToPixel ( calib . left , rect1 ) ; ImageType < T > imageType = ImageType . single ( activeAlg . getInputType ( ) ) ; FMatrixRMaj rect1_F32 = new FMatrixRMaj ( 3 , 3 ) ; // TODO simplify code some how FMatrixRMaj rect2_F32 = new FMatrixRMaj ( 3 , 3 ) ; ConvertMatrixData . convert ( rect1 , rect1_F32 ) ; ConvertMatrixData . convert ( rect2 , rect2_F32 ) ; ImageDistort < T , T > distortRect1 = RectifyImageOps . rectifyImage ( calib . left , rect1_F32 , BorderType . SKIP , imageType ) ; ImageDistort < T , T > distortRect2 = RectifyImageOps . rectifyImage ( calib . right , rect2_F32 , BorderType . SKIP , imageType ) ; // rectify and undo distortion distortRect1 . apply ( inputLeft , rectLeft ) ; distortRect2 . apply ( inputRight , rectRight ) ; rectifiedImages = true ; }
Removes distortion and rectifies images .