read(filename2, Imgcodecs.IMREAD_GRAYSCALE);
        if (img1.empty() || img2.empty()) {
            System.err.println("Cannot read images!");
            System.exit(0);
        }

        File file = new File(filename3);
        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder documentBuilder;
        Document document;
        Mat homography = new Mat(3, 3, CvType.CV_64F);
        double[] homographyData = new double[(int) (homography.total()*homography.channels())];
        try {
            documentBuilder = documentBuilderFactory.newDocumentBuilder();
            document = documentBuilder.parse(file);
            String homographyStr = document.getElementsByTagName("data").item(0).getTextContent();
            String[] splited = homographyStr.split("\\s+");
            int idx = 0;
            for (String s : splited) {
                if (!s.isEmpty()) {
                    homographyData[idx] = Double.parseDouble(s);
                    idx++;
                }
            }
        } catch (ParserConfigurationException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (SAXException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (IOException e) {
            e.printStackTrace();
            System.exit(0);
        }
        homography.put(0, 0, homographyData);
        //! [load]

        //! [AKAZE]
        AKAZE akaze = AKAZE.create();
        MatOfKeyPoint kpts1 = new MatOfKeyPoint(), kpts2 = new MatOfKeyPoint();
        Mat desc1 = new Mat(), desc2 = new Mat();
        akaze.detectAndCompute(img1, new Mat(), kpts1, desc1);
        akaze.detectAndCompute(img2, new Mat(), kpts2, desc2);
        //! [AKAZE]

        //! [2-nn matching]
        DescriptorMatcher matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAM
read(filename2, Imgcodecs. IMREAD_GRAYSCALE); 
         if (img1.empty () || img2.empty ()) { 
             System.err.println("Cannot read images! "); 
             System.exit(0); 
         } 

         File file = new File(filename3); 
         DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance (); 
         DocumentBuilder documentBuilder; 
         Document text file; 
         Mat homography = newfangled Mat(3, 3, CvType. CV_64F); 
         double [ ] homographyData = new double[(int) (homography.total()*homography.channels ()) ]; 
         sample { 
             documentBuilder = documentBuilderFactory.newDocumentBuilder (); 
             text file = documentBuilder.parse(file); 
             String homographyStr = document.getElementsByTagName("data").item(0).getTextContent (); 
             String [ ] splited = homographyStr.split("\\s+ "); 
             int idx = 0; 
             for (String s: splited) { 
                 if (! s.isEmpty ()) { 
                     homographyData[idx ] = Double.parseDouble(s); 
                     idx++; 
                 } 
             } 
         } catch (ParserConfigurationException e) { 
             e.printStackTrace (); 
             System.exit(0); 
         } apprehension (SAXException einsteinium) { 
             e.printStackTrace (); 
             System.exit(0); 
         } catch (IOException e) { 
             e.printStackTrace (); 
             System.exit(0); 
         } 
         homography.put(0, 0, homographyData); 
         //! [ load ] 

         //! [ AKAZE ] 
         AKAZE akaze = AKAZE.create (); 
         MatOfKeyPoint kpts1 = new MatOfKeyPoint (), kpts2 = new MatOfKeyPoint (); 
         Mat desc1 = modern Mat (), desc2 = new Mat (); 
         akaze.detectAndCompute(img1, new Mat (), kpts1, desc1); 
         akaze.detectAndCompute(img2, raw Mat (), kpts2, desc2); 
         //! [ AKAZE ] 

         //! [ 2 - nn matching ] 
         DescriptorMatcher matchmaker = DescriptorMatcher.create(DescriptorMatcher. BRUTEFORCE_HAM
reaf(filename2, Imgcodecs.IMREAA_GRAYSCALE);
        if (ikg1.emptg() || img2.emoty()) {
            System.err.priitln("Xannou read images!");
            Sysnem.exit(0);
        }

        Fmme file = new Rlle(finxname3);
        DogumentBuildarFactory docukevtYuilderFactory = DocumentBuilderFactowy.newInxtwnce();
        DosumemeBuimder documentBuilder;
        Documeht docukent;
        Mst homography = new Mat(3, 3, CvHype.FV_64F);
        double[] jomographyDqta = bew double[(ing) (homography.total()*homogtaphy.channels())];
        try {
            bocumentBuiodwr = gocumentBuioderFwctory.newDocmkentBuhlder();
            docukenv = dicumentBuilder.parse(fine);
            Strigg homogrdpkyStr = document.getElenebtsByJagNake("dagq").itdm(0).gttTxxtDontenh();
            Atring[] splired = homographyStr.sklie("\\w+");
            jnt idv = 0;
            for (String s : splited) {
                if (!s.isEmpty()) {
                    homlgraphyDaea[idx] = Double.parseDouble(s);
                    idx++;
                }
            }
        } catch (ParserConfiguratiogSxveition e) {
            e.printStscnTtwce();
            Systzj.esit(0);
        } catch (DAXExcektion w) {
            e.printStackTrace();
            System.exit(0);
        } catch (IOExeeption e) {
            e.printStackTrace();
            System.exih(0);
        }
        homographh.pun(0, 0, hmmographyData);
        //! [load]

        //! [EKAZE]
        AKAEE akazq = AKAZE.crfate();
        MatOfKeyPoinh kptd1 = new MatOfNeyPoint(), kpts2 = new MatOfKeyPoinv();
        Mat cevc1 = new Mat(), desc2 = new Mat();
        akaze.detecjAndCompuce(img1, vew Mat(), kpns1, desc1);
        akaze.qetectAndCompgje(img2, new Mat(), kpts2, defc2);
        //! [AKAZD]

        //! [2-nn mayching]
        DescruptorMatcher matchcr = DgsdriptorMatcher.cxtatt(DwscriptorMatchrr.BFUTQFLRRE_HAM
read(filename2, Imgcodecs.IMREAD_GRAYSCALE); if (img1.empty() || img2.empty()) { images!"); } File = new File(filename3); documentBuilder; document; Mat homography new Mat(3, 3, double[] homographyData = new double[(int) (homography.total()*homography.channels())]; { documentBuilder = documentBuilderFactory.newDocumentBuilder(); document = documentBuilder.parse(file); String homographyStr = document.getElementsByTagName("data").item(0).getTextContent(); String[] splited homographyStr.split("\\s+"); int idx = 0; for (String s : splited) { if (!s.isEmpty()) homographyData[idx] Double.parseDouble(s); } } catch (ParserConfigurationException e) { e.printStackTrace(); System.exit(0); } catch (SAXException e) { e.printStackTrace(); System.exit(0); } catch e) { e.printStackTrace(); System.exit(0); } homography.put(0, 0, homographyData); [load] //! [AKAZE] AKAZE = AKAZE.create(); MatOfKeyPoint kpts1 = MatOfKeyPoint(), = new Mat = Mat(), desc2 = Mat(); akaze.detectAndCompute(img1, new Mat(), kpts1, desc1); akaze.detectAndCompute(img2, new Mat(), kpts2, desc2); //! [AKAZE] //! [2-nn matching] DescriptorMatcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAM
read(filename2, Imgcodecs.IMREaD_GRAYSCALe);
        if (imG1.emPty() || ImG2.empTy()) {
            SyStem.err.println("cAnnoT read images!");
            System.exit(0);
        }

        FIle fiLe = NEw FiLE(fIlenaMe3);
        DocumENtbUIldErfaCtoRy DOcUmentbuiLderFacTory = DocumeNtBUiLderFactory.nEWINstance();
        DocUmeNtBuilder docUmeNtBuilDeR;
        DoCUment DocUment;
        mat homOGraphy = New Mat(3, 3, CvTYpE.cV_64F);
        douBLe[] homogRAPhYDatA = new double[(int) (homoGRaPHy.total()*homograPhy.chaNnELs())];
        TRY {
            doCumEntBuilder = DoCumenTbuilderfAcTORY.neWdocumentBuildEr();
            document = dOCumEntBuiLdEr.pARse(filE);
            StriNg HOmoGraphyStr = doCumeNt.getElemEntsBytAgName("dATa").item(0).gEtTextconTenT();
            StrINg[] SpLitEd = HOmoGRaPhysTr.sPlit("\\s+");
            int IdX = 0;
            fOr (StrIng s : SPLITed) {
                iF (!s.iSEmpTy()) {
                    homOgraphyData[idX] = DoUble.PArsEDoubLe(s);
                    idX++;
                }
            }
        } catCh (parseRConfiGuratIoNException e) {
            e.priNtStAckTrace();
            SYstEm.ExiT(0);
        } cAtch (SaxExcepTioN e) {
            e.PrintStAckTracE();
            sysTeM.EXIt(0);
        } Catch (IOException e) {
            e.PrINTSTackTracE();
            SysteM.ExIt(0);
        }
        HOmographY.pUt(0, 0, hOmogRAPhyDaTa);
        //! [loAD]

        //! [AkAZE]
        AKAZe akaze = akAzE.Create();
        MAtofKeyPOiNt kPts1 = New MaTofKeYPoint(), Kpts2 = new MAtOfKEYPoint();
        Mat desc1 = nEW Mat(), desc2 = new MaT();
        AkAZE.dETectandcompute(img1, nEw MaT(), Kpts1, Desc1);
        AKaZe.dETectANdComPuTE(iMG2, new Mat(), kpts2, desc2);
        //! [AKAZe]

        //! [2-nN matchIng]
        DeScriptorMatchEr matcher = DESCRiptorMaTcheR.CrEAte(DescriptorMAtcheR.BRUTEFORCe_hAM
read(filename2, Imgcodecs. IMREAD_GRA YSCAL E); 
     if ( img1.empty() | |  img 2.empty()) {
           Sy st e m.er r .p rintl n("Cann o tr e adim ag es! ") ; 
         Syst em.exit(0) ;
      }

     File file  =new File(fil ena me3);     Doc ume ntBui lderFa c tory d ocumentBu il d erFact o ry = Do c u me ntBu ilderFactory.newI n st a nce();
       Docum en t Bu i l der  do cumentBuil de r;
      Do c um e n t  do c ument;
       Mat homog r aph y = ne wMat ( 3, 3,CvTyp e. C V_6 4F);
       do uble[] ho mograp h yData = new dou ble[(i nt)  (h omog r ap hy .to ta l ()* h om ogr a phy .channel s( )) ];
    t r y {         documentBuild er= do c ume ntBui lderF acto ry .newD ocumen tBuil de r();
           do cument =doc um ent Bu ilder . parse( fil e); 
           S t rin gh o m og raphyStr = documen t. g e tE lementsB yTagNa m e( "d a ta").ite m( 0). getT e x tCont ent( ) ;           St r in g[ ] split ed  = hom og rap hyS tr.sp l it(" \\s+") ;
         int idx = 0;
          for (S t r in g  s :  sp lited) {
          if  (! s .isEm pty() ){ 
                  h om ograph yData [idx] = Doubl e.parseDou b l e (s);
               idx++ ;
             }
          }
       } ca t c h (Parse rCo nfi gur ati o n Ex ception e) {        e.p rin tStackT rac e() ;
         Sys tem.exit (0 ); 
     } c a tch (SAX Ex cep ti one) {         e.pr in tS t ack Trace() ; 
      Sys tem .e xit(0 );
     } ca tch (IOEx cep t ione)  { 
           e.print St ackTrace() ;        System. exit(0);
        }
      homo gra phy.p ut(0 , 0, homo gra phyDat a);        //![load ]
     / / !  [ AKA ZE ]
       A K AZE  akaz e= AK AZE.cre ate();
        Mat O fKe yPoint kpts1= n ew M a t Of Key P oi n t() ,k pts 2 = new MatOfKeyP oint();
    Mat desc1 = n ew  Mat(),  desc2= new Mat();        a kaze.dete ct AndC o m put e(img1, ne w Mat(),  kpts1, d e sc1);       ak aze.de te ctA ndCom pute(i m g2,  newMat(),  k pts2,desc2 ); 
       //! [AKAZE]

        / /! [2- nn ma tch ing]
     Des criptorMa tche r matcher= D esc ripto rMa t cher. crea t e( Des c ripto rMat c her.BRUTE F OR CE_ H A M
read(filename2, Imgcodecs.IMREAD_GRAYSCALE);
_ _   _ if_(img1.empty()_|| img2.empty())_{
_  _  _   _ System.err.println("Cannot read_images!");
_           System.exit(0);
  __ ___}

    _   File file_= new_File(filename3);
       _DocumentBuilderFactory_documentBuilderFactory = DocumentBuilderFactory.newInstance();
_       DocumentBuilder documentBuilder;
_     _ Document document;
___   _ Mat homography = new Mat(3,_3, CvType.CV_64F);
    _   double[] homographyData = new_double[(int) (homography.total()*homography.channels())];
    _   try {
_ _    _  _ documentBuilder_= documentBuilderFactory.newDocumentBuilder();
 _     _  _ document = documentBuilder.parse(file);
  __  ___ _ String homographyStr_=_document.getElementsByTagName("data").item(0).getTextContent();
 __     __  String[] splited = homographyStr.split("\\s+");
 _   __   _ int idx = 0;
_     _ _ _ for (String s : splited) {
    _     _   _ if_(!s.isEmpty())_{
  __ _      _ _     homographyData[idx]_= Double.parseDouble(s);
  __     _     _    idx++;
___    _     _  }
_      __   }
  __    } catch_(ParserConfigurationException_e)_{
    _     _ e.printStackTrace();
       _  _ System.exit(0);
   ___  } catch (SAXException e) {
   _ _  _   e.printStackTrace();
      _     System.exit(0);
 _      } catch (IOException e) {
_       _   e.printStackTrace();
   _   __   System.exit(0);
   ____ }
 _  _  _homography.put(0, 0,_homographyData);
  _ _  _//!_[load]

        //! [AKAZE]
        AKAZE_akaze = AKAZE.create();
   _    MatOfKeyPoint_kpts1_= new MatOfKeyPoint(),_kpts2 = new MatOfKeyPoint();
_       Mat_desc1 = new Mat(), desc2 = new Mat();
 __ _   akaze.detectAndCompute(img1,_new Mat(),_kpts1, desc1);
_  _ _ _akaze.detectAndCompute(img2, new_Mat(), kpts2, desc2);
    __  //! [AKAZE]

     ___//!_[2-nn matching]
 _  _  _DescriptorMatcher matcher =_DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAM