public static < T extends ImageGray < T > > void stitch ( BufferedImage imageA , BufferedImage imageB , Class < T > imageType ) { T inputA = ConvertBufferedImage . convertFromSingle ( imageA , null , imageType ) ; T inputB = ConvertBufferedImage . convertFromSingle ( imageB , null , imageType ) ; // Detect using the standard SURF feature descriptor and describer DetectDescribePoint detDesc = FactoryDetectDescribe . surfStable ( new ConfigFastHessian ( 1 , 2 , 200 , 1 , 9 , 4 , 4 ) , null , null , imageType ) ; ScoreAssociation < BrightFeature > scorer = FactoryAssociation . scoreEuclidean ( BrightFeature . class , true ) ; AssociateDescription < BrightFeature > associate = FactoryAssociation . greedy ( scorer , 2 , true ) ; // fit the images using a homography. This works well for rotations and distant objects. ModelMatcher < Homography2D_F64 , AssociatedPair > modelMatcher = FactoryMultiViewRobust . homographyRansac ( null , new ConfigRansac ( 60 , 3 ) ) ; Homography2D_F64 H = computeTransform ( inputA , inputB , detDesc , associate , modelMatcher ) ; renderStitching ( imageA , imageB , H ) ; }
Given two input images create and display an image where the two have been overlayed on top of each other .