Como viewificair se duas imagens são semelhantes ou não estão usando o openCV no java?

Eu tenho que viewificair se duas imagens são semelhantes ou não em Java usando OpenCV, estou usando o OpenCV paira isso e usando ORB

Aqui está a minha class principal

  • MultipairtBuilder não pode ser resolvido em okhttp: 3.0.0-RC1
  • Posso esconder os events de toque do Android?
  • Usando os pais paira resources desenháveis
  • Erro de return de dispositivos adb: crash de protocolo (sem status)
  • Como chamair a function da atividade principal do ArrayAdapter personalizado?
  • Android Support Librairy Manual Download
  • System.out.println("Welcome to OpenCV " + Core.VERSION); System.loadLibrairy(Core.NATIVE_LIBRARY_NAME);()); System.out.println(System.getProperty("user.dir")); File f1 = new File(System.getProperty("user.dir") + "\\test.jpg"); File f2 = new File(System.getProperty("user.dir") + "\\test2.jpg"); MatchingDemo2 m = new MatchingDemo2(); m.mth(f1.getAbsolutePath(), f2.getAbsolutePath()); 

    E aqui está o meu file MatchingDemo2.java

     public class MatchingDemo2 { public void mth(String inFile, String templateFile){ FeatureDetector detector = FeatureDetector.create(FeatureDetector.ORB); //Create descriptors //first image // generate descriptors //second image // generate descriptors System.out.println("size " + matches.size()); //HOW DO I KNOW IF IMAGES MATCHED OR NOT ???? //THIS CODE IS FOR CONNECTIONS BUT I AM NOT ABLE TO DO IT //feature and connection colors Scalair RED = new Scalair(255,0,0); Scalair GREEN = new Scalair(0,255,0); //output image Mat outputImg = new Mat(); MatOfByte drawnMatches = new MatOfByte(); //this will draw all matches, works fine Features2d.drawMatches(img1, keypoints1, img2, keypoints2, matches, outputImg, GREEN, RED, drawnMatches, Features2d.NOT_DRAW_SINGLE_POINTS); int DIST_LIMIT = 80; List<DMatch> matchList = matches.toList(); List<DMatch> matches_final = new ArrayList<DMatch>(); for(int i=0; i<matchList.size(); i++){ if(matchList.get(i).distance <= DIST_LIMIT){ matches_final.add(matches.toList().get(i)); } } MatOfDMatch matches_final_mat = new MatOfDMatch(); matches_final_mat.fromList(matches_final); for(int i=0; i< matches_final.size(); i++){ System.out.println("Good Matchs "+ matches_final.get(i)); } } } } public class MatchingDemo2 { public void mth(String inFile, String templateFile){ FeatureDetector detector = FeatureDetector.create(FeatureDetector.ORB); //Create descriptors //first image // generate descriptors //second image // generate descriptors System.out.println("size " + matches.size()); //HOW DO I KNOW IF IMAGES MATCHED OR NOT ???? //THIS CODE IS FOR CONNECTIONS BUT I AM NOT ABLE TO DO IT //feature and connection colors Scalair RED = new Scalair(255,0,0); Scalair GREEN = new Scalair(0,255,0); //output image Mat outputImg = new Mat(); MatOfByte drawnMatches = new MatOfByte(); //this will draw all matches, works fine Features2d.drawMatches(img1, keypoints1, img2, keypoints2, matches, outputImg, GREEN, RED, drawnMatches, Features2d.NOT_DRAW_SINGLE_POINTS); int DIST_LIMIT = 80; List<DMatch> matchList = matches.toList(); List<DMatch> matches_final = new ArrayList<DMatch>(); for(int i=0; i<matchList.size(); i++){ if(matchList.get(i).distance <= DIST_LIMIT){ matches_final.add(matches.toList().get(i)); } } MatOfDMatch matches_final_mat = new MatOfDMatch(); matches_final_mat.fromList(matches_final); for(int i=0; i< matches_final.size(); i++){ System.out.println("Good Matchs "+ matches_final.get(i)); } } } } public class MatchingDemo2 { public void mth(String inFile, String templateFile){ FeatureDetector detector = FeatureDetector.create(FeatureDetector.ORB); //Create descriptors //first image // generate descriptors //second image // generate descriptors System.out.println("size " + matches.size()); //HOW DO I KNOW IF IMAGES MATCHED OR NOT ???? //THIS CODE IS FOR CONNECTIONS BUT I AM NOT ABLE TO DO IT //feature and connection colors Scalair RED = new Scalair(255,0,0); Scalair GREEN = new Scalair(0,255,0); //output image Mat outputImg = new Mat(); MatOfByte drawnMatches = new MatOfByte(); //this will draw all matches, works fine Features2d.drawMatches(img1, keypoints1, img2, keypoints2, matches, outputImg, GREEN, RED, drawnMatches, Features2d.NOT_DRAW_SINGLE_POINTS); int DIST_LIMIT = 80; List<DMatch> matchList = matches.toList(); List<DMatch> matches_final = new ArrayList<DMatch>(); for(int i=0; i<matchList.size(); i++){ if(matchList.get(i).distance <= DIST_LIMIT){ matches_final.add(matches.toList().get(i)); } } MatOfDMatch matches_final_mat = new MatOfDMatch(); matches_final_mat.fromList(matches_final); for(int i=0; i< matches_final.size(); i++){ System.out.println("Good Matchs "+ matches_final.get(i)); } } } } public class MatchingDemo2 { public void mth(String inFile, String templateFile){ FeatureDetector detector = FeatureDetector.create(FeatureDetector.ORB); //Create descriptors //first image // generate descriptors //second image // generate descriptors System.out.println("size " + matches.size()); //HOW DO I KNOW IF IMAGES MATCHED OR NOT ???? //THIS CODE IS FOR CONNECTIONS BUT I AM NOT ABLE TO DO IT //feature and connection colors Scalair RED = new Scalair(255,0,0); Scalair GREEN = new Scalair(0,255,0); //output image Mat outputImg = new Mat(); MatOfByte drawnMatches = new MatOfByte(); //this will draw all matches, works fine Features2d.drawMatches(img1, keypoints1, img2, keypoints2, matches, outputImg, GREEN, RED, drawnMatches, Features2d.NOT_DRAW_SINGLE_POINTS); int DIST_LIMIT = 80; List<DMatch> matchList = matches.toList(); List<DMatch> matches_final = new ArrayList<DMatch>(); for(int i=0; i<matchList.size(); i++){ if(matchList.get(i).distance <= DIST_LIMIT){ matches_final.add(matches.toList().get(i)); } } MatOfDMatch matches_final_mat = new MatOfDMatch(); matches_final_mat.fromList(matches_final); for(int i=0; i< matches_final.size(); i++){ System.out.println("Good Matchs "+ matches_final.get(i)); } } } } public class MatchingDemo2 { public void mth(String inFile, String templateFile){ FeatureDetector detector = FeatureDetector.create(FeatureDetector.ORB); //Create descriptors //first image // generate descriptors //second image // generate descriptors System.out.println("size " + matches.size()); //HOW DO I KNOW IF IMAGES MATCHED OR NOT ???? //THIS CODE IS FOR CONNECTIONS BUT I AM NOT ABLE TO DO IT //feature and connection colors Scalair RED = new Scalair(255,0,0); Scalair GREEN = new Scalair(0,255,0); //output image Mat outputImg = new Mat(); MatOfByte drawnMatches = new MatOfByte(); //this will draw all matches, works fine Features2d.drawMatches(img1, keypoints1, img2, keypoints2, matches, outputImg, GREEN, RED, drawnMatches, Features2d.NOT_DRAW_SINGLE_POINTS); int DIST_LIMIT = 80; List<DMatch> matchList = matches.toList(); List<DMatch> matches_final = new ArrayList<DMatch>(); for(int i=0; i<matchList.size(); i++){ if(matchList.get(i).distance <= DIST_LIMIT){ matches_final.add(matches.toList().get(i)); } } MatOfDMatch matches_final_mat = new MatOfDMatch(); matches_final_mat.fromList(matches_final); for(int i=0; i< matches_final.size(); i++){ System.out.println("Good Matchs "+ matches_final.get(i)); } } } 

    Mas quando eu viewificair os bons jogos, eu recebo isso

      size 1x328 Good Matchs DMatch [queryIdx=0, trainIdx=93, imgIdx=0, distance=52.0] Good Matchs DMatch [queryIdx=1, trainIdx=173, imgIdx=0, distance=57.0] Good Matchs DMatch [queryIdx=2, trainIdx=92, imgIdx=0, distance=53.0] Good Matchs DMatch [queryIdx=3, trainIdx=80, imgIdx=0, distance=26.0] Good Matchs DMatch [queryIdx=5, trainIdx=164, imgIdx=0, distance=40.0] Good Matchs DMatch [queryIdx=6, trainIdx=228, imgIdx=0, distance=53.0] Good Matchs DMatch [queryIdx=7, trainIdx=179, imgIdx=0, distance=14.0] Good Matchs DMatch [queryIdx=8, trainIdx=78, imgIdx=0, distance=61.0] Good Matchs DMatch [queryIdx=9, trainIdx=166, imgIdx=0, distance=69.0] Good Matchs DMatch [queryIdx=10, trainIdx=74, imgIdx=0, distance=65.0] Good Matchs DMatch [queryIdx=11, trainIdx=245, imgIdx=0, distance=38.0] Good Matchs DMatch [queryIdx=12, trainIdx=120, imgIdx=0, distance=66.0] Good Matchs DMatch [queryIdx=13, trainIdx=244, imgIdx=0, distance=41.0] Good Matchs DMatch [queryIdx=14, trainIdx=67, imgIdx=0, distance=50.0] Good Matchs DMatch [queryIdx=15, trainIdx=185, imgIdx=0, distance=55.0] Good Matchs DMatch [queryIdx=16, trainIdx=97, imgIdx=0, distance=21.0] Good Matchs DMatch [queryIdx=17, trainIdx=172, imgIdx=0, distance=67.0] Good Matchs DMatch [queryIdx=18, trainIdx=354, imgIdx=0, distance=67.0] Good Matchs DMatch [queryIdx=19, trainIdx=302, imgIdx=0, distance=53.0] Good Matchs DMatch [queryIdx=20, trainIdx=176, imgIdx=0, distance=59.0] Good Matchs DMatch [queryIdx=21, trainIdx=60, imgIdx=0, distance=66.0] Good Matchs DMatch [queryIdx=22, trainIdx=72, imgIdx=0, distance=62.0] Good Matchs DMatch [queryIdx=23, trainIdx=63, imgIdx=0, distance=54.0] Good Matchs DMatch [queryIdx=24, trainIdx=176, imgIdx=0, distance=63.0] Good Matchs DMatch [queryIdx=25, trainIdx=49, imgIdx=0, distance=58.0] Good Matchs DMatch [queryIdx=26, trainIdx=77, imgIdx=0, distance=52.0] Good Matchs DMatch [queryIdx=27, trainIdx=302, imgIdx=0, distance=59.0] Good Matchs DMatch [queryIdx=28, trainIdx=265, imgIdx=0, distance=71.0] Good Matchs DMatch [queryIdx=29, trainIdx=67, imgIdx=0, distance=49.0] Good Matchs DMatch [queryIdx=30, trainIdx=302, imgIdx=0, distance=64.0] Good Matchs DMatch [queryIdx=31, trainIdx=265, imgIdx=0, distance=65.0] Good Matchs DMatch [queryIdx=32, trainIdx=73, imgIdx=0, distance=73.0] Good Matchs DMatch [queryIdx=33, trainIdx=67, imgIdx=0, distance=55.0] Good Matchs DMatch [queryIdx=34, trainIdx=283, imgIdx=0, distance=63.0] Good Matchs DMatch [queryIdx=35, trainIdx=145, imgIdx=0, distance=60.0] Good Matchs DMatch [queryIdx=36, trainIdx=71, imgIdx=0, distance=54.0] Good Matchs DMatch [queryIdx=37, trainIdx=167, imgIdx=0, distance=67.0] Good Matchs DMatch [queryIdx=38, trainIdx=94, imgIdx=0, distance=60.0] Good Matchs DMatch [queryIdx=39, trainIdx=88, imgIdx=0, distance=68.0] Good Matchs DMatch [queryIdx=40, trainIdx=88, imgIdx=0, distance=69.0] Good Matchs DMatch [queryIdx=41, trainIdx=179, imgIdx=0, distance=28.0] Good Matchs DMatch [queryIdx=42, trainIdx=64, imgIdx=0, distance=61.0] Good Matchs DMatch [queryIdx=43, trainIdx=223, imgIdx=0, distance=71.0] Good Matchs DMatch [queryIdx=44, trainIdx=80, imgIdx=0, distance=30.0] Good Matchs DMatch [queryIdx=45, trainIdx=196, imgIdx=0, distance=59.0] Good Matchs DMatch [queryIdx=46, trainIdx=52, imgIdx=0, distance=65.0] Good Matchs DMatch [queryIdx=47, trainIdx=93, imgIdx=0, distance=60.0] Good Matchs DMatch [queryIdx=48, trainIdx=187, imgIdx=0, distance=49.0] Good Matchs DMatch [queryIdx=49, trainIdx=179, imgIdx=0, distance=50.0] Good Matchs DMatch [queryIdx=50, trainIdx=283, imgIdx=0, distance=59.0] Good Matchs DMatch [queryIdx=51, trainIdx=171, imgIdx=0, distance=61.0] Good Matchs DMatch [queryIdx=52, trainIdx=302, imgIdx=0, distance=60.0] Good Matchs DMatch [queryIdx=53, trainIdx=67, imgIdx=0, distance=59.0] Good Matchs DMatch [queryIdx=54, trainIdx=15, imgIdx=0, distance=59.0] Good Matchs DMatch [queryIdx=55, trainIdx=173, imgIdx=0, distance=66.0] Good Matchs DMatch [queryIdx=56, trainIdx=302, imgIdx=0, distance=56.0] Good Matchs DMatch [queryIdx=57, trainIdx=47, imgIdx=0, distance=56.0] Good Matchs DMatch [queryIdx=58, trainIdx=187, imgIdx=0, distance=58.0] Good Matchs DMatch [queryIdx=59, trainIdx=344, imgIdx=0, distance=64.0] Good Matchs DMatch [queryIdx=60, trainIdx=164, imgIdx=0, distance=65.0] Good Matchs DMatch [queryIdx=61, trainIdx=125, imgIdx=0, distance=50.0] Good Matchs DMatch [queryIdx=62, trainIdx=77, imgIdx=0, distance=72.0] Good Matchs DMatch [queryIdx=63, trainIdx=22, imgIdx=0, distance=79.0] Good Matchs DMatch [queryIdx=64, trainIdx=82, imgIdx=0, distance=69.0] Good Matchs DMatch [queryIdx=65, trainIdx=93, imgIdx=0, distance=63.0] Good Matchs DMatch [queryIdx=66, trainIdx=241, imgIdx=0, distance=35.0] Good Matchs DMatch [queryIdx=67, trainIdx=80, imgIdx=0, distance=18.0] Good Matchs DMatch [queryIdx=68, trainIdx=179, imgIdx=0, distance=20.0] Good Matchs DMatch [queryIdx=69, trainIdx=242, imgIdx=0, distance=50.0] Good Matchs DMatch [queryIdx=70, trainIdx=80, imgIdx=0, distance=22.0] Good Matchs DMatch [queryIdx=71, trainIdx=179, imgIdx=0, distance=19.0] Good Matchs DMatch [queryIdx=72, trainIdx=92, imgIdx=0, distance=59.0] Good Matchs DMatch [queryIdx=73, trainIdx=94, imgIdx=0, distance=56.0] Good Matchs DMatch [queryIdx=74, trainIdx=173, imgIdx=0, distance=49.0] Good Matchs DMatch [queryIdx=75, trainIdx=94, imgIdx=0, distance=59.0] Good Matchs DMatch [queryIdx=76, trainIdx=94, imgIdx=0, distance=48.0] Good Matchs DMatch [queryIdx=77, trainIdx=92, imgIdx=0, distance=52.0] Good Matchs DMatch [queryIdx=78, trainIdx=80, imgIdx=0, distance=20.0] Good Matchs DMatch [queryIdx=80, trainIdx=119, imgIdx=0, distance=61.0] Good Matchs DMatch [queryIdx=81, trainIdx=228, imgIdx=0, distance=47.0] Good Matchs DMatch [queryIdx=82, trainIdx=179, imgIdx=0, distance=14.0] Good Matchs DMatch [queryIdx=83, trainIdx=227, imgIdx=0, distance=52.0] Good Matchs DMatch [queryIdx=84, trainIdx=84, imgIdx=0, distance=57.0] Good Matchs DMatch [queryIdx=85, trainIdx=245, imgIdx=0, distance=40.0] Good Matchs DMatch [queryIdx=86, trainIdx=58, imgIdx=0, distance=64.0] Good Matchs DMatch [queryIdx=87, trainIdx=14, imgIdx=0, distance=62.0] Good Matchs DMatch [queryIdx=88, trainIdx=187, imgIdx=0, distance=61.0] Good Matchs DMatch [queryIdx=89, trainIdx=185, imgIdx=0, distance=57.0] Good Matchs DMatch [queryIdx=90, trainIdx=178, imgIdx=0, distance=25.0] Good Matchs DMatch [queryIdx=91, trainIdx=220, imgIdx=0, distance=56.0] Good Matchs DMatch [queryIdx=92, trainIdx=205, imgIdx=0, distance=59.0] Good Matchs DMatch [queryIdx=93, trainIdx=60, imgIdx=0, distance=61.0] Good Matchs DMatch [queryIdx=94, trainIdx=44, imgIdx=0, distance=59.0] Good Matchs DMatch [queryIdx=95, trainIdx=16, imgIdx=0, distance=72.0] Good Matchs DMatch [queryIdx=96, trainIdx=157, imgIdx=0, distance=63.0] Good Matchs DMatch [queryIdx=97, trainIdx=135, imgIdx=0, distance=52.0] Good Matchs DMatch [queryIdx=98, trainIdx=60, imgIdx=0, distance=61.0] Good Matchs DMatch [queryIdx=99, trainIdx=344, imgIdx=0, distance=60.0] Good Matchs DMatch [queryIdx=100, trainIdx=77, imgIdx=0, distance=67.0] Good Matchs DMatch [queryIdx=101, trainIdx=95, imgIdx=0, distance=76.0] Good Matchs DMatch [queryIdx=102, trainIdx=72, imgIdx=0, distance=45.0] Good Matchs DMatch [queryIdx=103, trainIdx=134, imgIdx=0, distance=70.0] Good Matchs DMatch [queryIdx=104, trainIdx=154, imgIdx=0, distance=54.0] Good Matchs DMatch [queryIdx=105, trainIdx=208, imgIdx=0, distance=77.0] Good Matchs DMatch [queryIdx=106, trainIdx=73, imgIdx=0, distance=79.0] Good Matchs DMatch [queryIdx=107, trainIdx=72, imgIdx=0, distance=61.0] Good Matchs DMatch [queryIdx=108, trainIdx=64, imgIdx=0, distance=73.0] Good Matchs DMatch [queryIdx=109, trainIdx=72, imgIdx=0, distance=63.0] Good Matchs DMatch [queryIdx=110, trainIdx=365, imgIdx=0, distance=66.0] Good Matchs DMatch [queryIdx=111, trainIdx=148, imgIdx=0, distance=64.0] Good Matchs DMatch [queryIdx=112, trainIdx=81, imgIdx=0, distance=42.0] Good Matchs DMatch [queryIdx=113, trainIdx=56, imgIdx=0, distance=62.0] Good Matchs DMatch [queryIdx=114, trainIdx=162, imgIdx=0, distance=48.0] Good Matchs DMatch [queryIdx=115, trainIdx=56, imgIdx=0, distance=56.0] Good Matchs DMatch [queryIdx=116, trainIdx=120, imgIdx=0, distance=58.0] Good Matchs DMatch [queryIdx=117, trainIdx=72, imgIdx=0, distance=59.0] Good Matchs DMatch [queryIdx=118, trainIdx=92, imgIdx=0, distance=63.0] Good Matchs DMatch [queryIdx=119, trainIdx=131, imgIdx=0, distance=59.0] Good Matchs DMatch [queryIdx=120, trainIdx=72, imgIdx=0, distance=46.0] Good Matchs DMatch [queryIdx=121, trainIdx=74, imgIdx=0, distance=78.0] Good Matchs DMatch [queryIdx=122, trainIdx=94, imgIdx=0, distance=56.0] Good Matchs DMatch [queryIdx=123, trainIdx=72, imgIdx=0, distance=52.0] Good Matchs DMatch [queryIdx=124, trainIdx=134, imgIdx=0, distance=71.0] Good Matchs DMatch [queryIdx=125, trainIdx=72, imgIdx=0, distance=46.0] Good Matchs DMatch [queryIdx=126, trainIdx=15, imgIdx=0, distance=73.0] Good Matchs DMatch [queryIdx=127, trainIdx=72, imgIdx=0, distance=50.0] Good Matchs DMatch [queryIdx=128, trainIdx=93, imgIdx=0, distance=56.0] Good Matchs DMatch [queryIdx=129, trainIdx=68, imgIdx=0, distance=46.0] Good Matchs DMatch [queryIdx=130, trainIdx=205, imgIdx=0, distance=65.0] Good Matchs DMatch [queryIdx=131, trainIdx=187, imgIdx=0, distance=59.0] Good Matchs DMatch [queryIdx=132, trainIdx=72, imgIdx=0, distance=47.0] Good Matchs DMatch [queryIdx=133, trainIdx=220, imgIdx=0, distance=57.0] Good Matchs DMatch [queryIdx=134, trainIdx=289, imgIdx=0, distance=60.0] Good Matchs DMatch [queryIdx=135, trainIdx=82, imgIdx=0, distance=65.0] Good Matchs DMatch [queryIdx=136, trainIdx=93, imgIdx=0, distance=53.0] Good Matchs DMatch [queryIdx=137, trainIdx=244, imgIdx=0, distance=18.0] Good Matchs DMatch [queryIdx=138, trainIdx=244, imgIdx=0, distance=25.0] Good Matchs DMatch [queryIdx=139, trainIdx=92, imgIdx=0, distance=66.0] Good Matchs DMatch [queryIdx=140, trainIdx=244, imgIdx=0, distance=20.0] Good Matchs DMatch [queryIdx=141, trainIdx=93, imgIdx=0, distance=45.0] Good Matchs DMatch [queryIdx=142, trainIdx=93, imgIdx=0, distance=51.0] Good Matchs DMatch [queryIdx=143, trainIdx=94, imgIdx=0, distance=51.0] Good Matchs DMatch [queryIdx=144, trainIdx=94, imgIdx=0, distance=40.0] Good Matchs DMatch [queryIdx=145, trainIdx=93, imgIdx=0, distance=47.0] Good Matchs DMatch [queryIdx=146, trainIdx=244, imgIdx=0, distance=28.0] Good Matchs DMatch [queryIdx=147, trainIdx=172, imgIdx=0, distance=77.0] Good Matchs DMatch [queryIdx=148, trainIdx=170, imgIdx=0, distance=72.0] Good Matchs DMatch [queryIdx=149, trainIdx=261, imgIdx=0, distance=72.0] Good Matchs DMatch [queryIdx=150, trainIdx=228, imgIdx=0, distance=55.0] Good Matchs DMatch [queryIdx=151, trainIdx=179, imgIdx=0, distance=19.0] Good Matchs DMatch [queryIdx=152, trainIdx=227, imgIdx=0, distance=60.0] Good Matchs DMatch [queryIdx=153, trainIdx=107, imgIdx=0, distance=56.0] Good Matchs DMatch [queryIdx=154, trainIdx=174, imgIdx=0, distance=41.0] Good Matchs DMatch [queryIdx=155, trainIdx=283, imgIdx=0, distance=76.0] Good Matchs DMatch [queryIdx=156, trainIdx=254, imgIdx=0, distance=59.0] Good Matchs DMatch [queryIdx=157, trainIdx=185, imgIdx=0, distance=51.0] Good Matchs DMatch [queryIdx=158, trainIdx=178, imgIdx=0, distance=30.0] Good Matchs DMatch [queryIdx=159, trainIdx=278, imgIdx=0, distance=53.0] Good Matchs DMatch [queryIdx=160, trainIdx=91, imgIdx=0, distance=62.0] Good Matchs DMatch [queryIdx=161, trainIdx=148, imgIdx=0, distance=59.0] Good Matchs DMatch [queryIdx=162, trainIdx=157, imgIdx=0, distance=63.0] Good Matchs DMatch [queryIdx=163, trainIdx=373, imgIdx=0, distance=73.0] Good Matchs DMatch [queryIdx=164, trainIdx=226, imgIdx=0, distance=48.0] Good Matchs DMatch [queryIdx=165, trainIdx=278, imgIdx=0, distance=64.0] Good Matchs DMatch [queryIdx=166, trainIdx=283, imgIdx=0, distance=62.0] Good Matchs DMatch [queryIdx=167, trainIdx=196, imgIdx=0, distance=64.0] Good Matchs DMatch [queryIdx=168, trainIdx=344, imgIdx=0, distance=59.0] Good Matchs DMatch [queryIdx=169, trainIdx=157, imgIdx=0, distance=53.0] Good Matchs DMatch [queryIdx=170, trainIdx=144, imgIdx=0, distance=79.0] Good Matchs DMatch [queryIdx=171, trainIdx=154, imgIdx=0, distance=61.0] Good Matchs DMatch [queryIdx=172, trainIdx=211, imgIdx=0, distance=75.0] Good Matchs DMatch [queryIdx=173, trainIdx=279, imgIdx=0, distance=64.0] Good Matchs DMatch [queryIdx=174, trainIdx=211, imgIdx=0, distance=79.0] Good Matchs DMatch [queryIdx=175, trainIdx=220, imgIdx=0, distance=68.0] Good Matchs DMatch [queryIdx=176, trainIdx=218, imgIdx=0, distance=45.0] Good Matchs DMatch [queryIdx=177, trainIdx=289, imgIdx=0, distance=75.0] Good Matchs DMatch [queryIdx=178, trainIdx=223, imgIdx=0, distance=63.0] Good Matchs DMatch [queryIdx=179, trainIdx=57, imgIdx=0, distance=65.0] Good Matchs DMatch [queryIdx=180, trainIdx=36, imgIdx=0, distance=73.0] Good Matchs DMatch [queryIdx=181, trainIdx=111, imgIdx=0, distance=72.0] Good Matchs DMatch [queryIdx=182, trainIdx=93, imgIdx=0, distance=65.0] Good Matchs DMatch [queryIdx=183, trainIdx=137, imgIdx=0, distance=63.0] Good Matchs DMatch [queryIdx=184, trainIdx=157, imgIdx=0, distance=60.0] Good Matchs DMatch [queryIdx=185, trainIdx=72, imgIdx=0, distance=61.0] Good Matchs DMatch [queryIdx=186, trainIdx=172, imgIdx=0, distance=47.0] Good Matchs DMatch [queryIdx=187, trainIdx=279, imgIdx=0, distance=69.0] Good Matchs DMatch [queryIdx=188, trainIdx=72, imgIdx=0, distance=55.0] Good Matchs DMatch [queryIdx=189, trainIdx=96, imgIdx=0, distance=61.0] Good Matchs DMatch [queryIdx=190, trainIdx=220, imgIdx=0, distance=68.0] Good Matchs DMatch [queryIdx=191, trainIdx=93, imgIdx=0, distance=48.0] Good Matchs DMatch [queryIdx=192, trainIdx=279, imgIdx=0, distance=54.0] Good Matchs DMatch [queryIdx=193, trainIdx=157, imgIdx=0, distance=54.0] Good Matchs DMatch [queryIdx=194, trainIdx=91, imgIdx=0, distance=65.0] Good Matchs DMatch [queryIdx=195, trainIdx=278, imgIdx=0, distance=66.0] Good Matchs DMatch [queryIdx=196, trainIdx=220, imgIdx=0, distance=57.0] Good Matchs DMatch [queryIdx=197, trainIdx=74, imgIdx=0, distance=63.0] Good Matchs DMatch [queryIdx=198, trainIdx=93, imgIdx=0, distance=34.0] Good Matchs DMatch [queryIdx=199, trainIdx=81, imgIdx=0, distance=53.0] Good Matchs DMatch [queryIdx=200, trainIdx=93, imgIdx=0, distance=45.0] Good Matchs DMatch [queryIdx=201, trainIdx=90, imgIdx=0, distance=52.0] Good Matchs DMatch [queryIdx=202, trainIdx=93, imgIdx=0, distance=52.0] Good Matchs DMatch [queryIdx=203, trainIdx=94, imgIdx=0, distance=42.0] Good Matchs DMatch [queryIdx=204, trainIdx=93, imgIdx=0, distance=35.0] Good Matchs DMatch [queryIdx=205, trainIdx=94, imgIdx=0, distance=44.0] Good Matchs DMatch [queryIdx=206, trainIdx=90, imgIdx=0, distance=72.0] Good Matchs DMatch [queryIdx=207, trainIdx=179, imgIdx=0, distance=54.0] Good Matchs DMatch [queryIdx=208, trainIdx=92, imgIdx=0, distance=48.0] Good Matchs DMatch [queryIdx=209, trainIdx=91, imgIdx=0, distance=61.0] Good Matchs DMatch [queryIdx=210, trainIdx=119, imgIdx=0, distance=77.0] Good Matchs DMatch [queryIdx=211, trainIdx=227, imgIdx=0, distance=66.0] Good Matchs DMatch [queryIdx=212, trainIdx=186, imgIdx=0, distance=56.0] Good Matchs DMatch [queryIdx=213, trainIdx=96, imgIdx=0, distance=69.0] Good Matchs DMatch [queryIdx=214, trainIdx=77, imgIdx=0, distance=52.0] Good Matchs DMatch [queryIdx=215, trainIdx=372, imgIdx=0, distance=67.0] Good Matchs DMatch [queryIdx=216, trainIdx=334, imgIdx=0, distance=69.0] Good Matchs DMatch [queryIdx=217, trainIdx=278, imgIdx=0, distance=67.0] Good Matchs DMatch [queryIdx=218, trainIdx=325, imgIdx=0, distance=61.0] Good Matchs DMatch [queryIdx=219, trainIdx=188, imgIdx=0, distance=60.0] Good Matchs DMatch [queryIdx=220, trainIdx=340, imgIdx=0, distance=56.0] Good Matchs DMatch [queryIdx=221, trainIdx=72, imgIdx=0, distance=64.0] Good Matchs DMatch [queryIdx=222, trainIdx=278, imgIdx=0, distance=69.0] Good Matchs DMatch [queryIdx=223, trainIdx=221, imgIdx=0, distance=72.0] Good Matchs DMatch [queryIdx=224, trainIdx=339, imgIdx=0, distance=74.0] Good Matchs DMatch [queryIdx=225, trainIdx=155, imgIdx=0, distance=66.0] Good Matchs DMatch [queryIdx=226, trainIdx=278, imgIdx=0, distance=56.0] Good Matchs DMatch [queryIdx=227, trainIdx=165, imgIdx=0, distance=78.0] Good Matchs DMatch [queryIdx=228, trainIdx=279, imgIdx=0, distance=71.0] Good Matchs DMatch [queryIdx=229, trainIdx=355, imgIdx=0, distance=65.0] Good Matchs DMatch [queryIdx=231, trainIdx=69, imgIdx=0, distance=80.0] Good Matchs DMatch [queryIdx=232, trainIdx=278, imgIdx=0, distance=65.0] Good Matchs DMatch [queryIdx=233, trainIdx=65, imgIdx=0, distance=71.0] Good Matchs DMatch [queryIdx=234, trainIdx=93, imgIdx=0, distance=79.0] Good Matchs DMatch [queryIdx=235, trainIdx=203, imgIdx=0, distance=78.0] Good Matchs DMatch [queryIdx=236, trainIdx=159, imgIdx=0, distance=70.0] Good Matchs DMatch [queryIdx=237, trainIdx=93, imgIdx=0, distance=45.0] Good Matchs DMatch [queryIdx=238, trainIdx=172, imgIdx=0, distance=58.0] Good Matchs DMatch [queryIdx=239, trainIdx=374, imgIdx=0, distance=67.0] Good Matchs DMatch [queryIdx=240, trainIdx=278, imgIdx=0, distance=59.0] Good Matchs DMatch [queryIdx=241, trainIdx=223, imgIdx=0, distance=55.0] Good Matchs DMatch [queryIdx=242, trainIdx=365, imgIdx=0, distance=58.0] Good Matchs DMatch [queryIdx=243, trainIdx=91, imgIdx=0, distance=62.0] Good Matchs DMatch [queryIdx=244, trainIdx=238, imgIdx=0, distance=57.0] Good Matchs DMatch [queryIdx=245, trainIdx=299, imgIdx=0, distance=62.0] Good Matchs DMatch [queryIdx=246, trainIdx=289, imgIdx=0, distance=63.0] Good Matchs DMatch [queryIdx=247, trainIdx=93, imgIdx=0, distance=41.0] Good Matchs DMatch [queryIdx=249, trainIdx=5, imgIdx=0, distance=56.0] Good Matchs DMatch [queryIdx=250, trainIdx=93, imgIdx=0, distance=53.0] Good Matchs DMatch [queryIdx=251, trainIdx=93, imgIdx=0, distance=34.0] Good Matchs DMatch [queryIdx=252, trainIdx=97, imgIdx=0, distance=34.0] Good Matchs DMatch [queryIdx=253, trainIdx=93, imgIdx=0, distance=37.0] Good Matchs DMatch [queryIdx=254, trainIdx=174, imgIdx=0, distance=55.0] Good Matchs DMatch [queryIdx=255, trainIdx=91, imgIdx=0, distance=72.0] Good Matchs DMatch [queryIdx=256, trainIdx=81, imgIdx=0, distance=59.0] Good Matchs DMatch [queryIdx=257, trainIdx=92, imgIdx=0, distance=57.0] Good Matchs DMatch [queryIdx=258, trainIdx=212, imgIdx=0, distance=76.0] Good Matchs DMatch [queryIdx=259, trainIdx=119, imgIdx=0, distance=67.0] Good Matchs DMatch [queryIdx=260, trainIdx=228, imgIdx=0, distance=73.0] Good Matchs DMatch [queryIdx=261, trainIdx=119, imgIdx=0, distance=68.0] Good Matchs DMatch [queryIdx=263, trainIdx=266, imgIdx=0, distance=74.0] Good Matchs DMatch [queryIdx=264, trainIdx=319, imgIdx=0, distance=72.0] Good Matchs DMatch [queryIdx=265, trainIdx=157, imgIdx=0, distance=76.0] Good Matchs DMatch [queryIdx=266, trainIdx=365, imgIdx=0, distance=65.0] Good Matchs DMatch [queryIdx=267, trainIdx=341, imgIdx=0, distance=76.0] Good Matchs DMatch [queryIdx=268, trainIdx=303, imgIdx=0, distance=63.0] Good Matchs DMatch [queryIdx=269, trainIdx=313, imgIdx=0, distance=69.0] Good Matchs DMatch [queryIdx=271, trainIdx=350, imgIdx=0, distance=62.0] Good Matchs DMatch [queryIdx=272, trainIdx=313, imgIdx=0, distance=68.0] Good Matchs DMatch [queryIdx=278, trainIdx=267, imgIdx=0, distance=69.0] Good Matchs DMatch [queryIdx=280, trainIdx=223, imgIdx=0, distance=71.0] Good Matchs DMatch [queryIdx=281, trainIdx=267, imgIdx=0, distance=71.0] Good Matchs DMatch [queryIdx=283, trainIdx=334, imgIdx=0, distance=72.0] Good Matchs DMatch [queryIdx=284, trainIdx=313, imgIdx=0, distance=63.0] Good Matchs DMatch [queryIdx=285, trainIdx=78, imgIdx=0, distance=76.0] Good Matchs DMatch [queryIdx=286, trainIdx=312, imgIdx=0, distance=73.0] Good Matchs DMatch [queryIdx=287, trainIdx=271, imgIdx=0, distance=68.0] Good Matchs DMatch [queryIdx=288, trainIdx=170, imgIdx=0, distance=64.0] Good Matchs DMatch [queryIdx=289, trainIdx=278, imgIdx=0, distance=64.0] Good Matchs DMatch [queryIdx=290, trainIdx=282, imgIdx=0, distance=70.0] Good Matchs DMatch [queryIdx=291, trainIdx=91, imgIdx=0, distance=65.0] Good Matchs DMatch [queryIdx=292, trainIdx=334, imgIdx=0, distance=67.0] Good Matchs DMatch [queryIdx=293, trainIdx=80, imgIdx=0, distance=72.0] Good Matchs DMatch [queryIdx=294, trainIdx=92, imgIdx=0, distance=47.0] Good Matchs DMatch [queryIdx=295, trainIdx=301, imgIdx=0, distance=44.0] Good Matchs DMatch [queryIdx=297, trainIdx=220, imgIdx=0, distance=78.0] Good Matchs DMatch [queryIdx=298, trainIdx=374, imgIdx=0, distance=76.0] Good Matchs DMatch [queryIdx=300, trainIdx=329, imgIdx=0, distance=74.0] Good Matchs DMatch [queryIdx=302, trainIdx=285, imgIdx=0, distance=77.0] Good Matchs DMatch [queryIdx=305, trainIdx=271, imgIdx=0, distance=80.0] Good Matchs DMatch [queryIdx=307, trainIdx=350, imgIdx=0, distance=76.0] Good Matchs DMatch [queryIdx=308, trainIdx=320, imgIdx=0, distance=71.0] Good Matchs DMatch [queryIdx=309, trainIdx=163, imgIdx=0, distance=76.0] Good Matchs DMatch [queryIdx=310, trainIdx=170, imgIdx=0, distance=73.0] Good Matchs DMatch [queryIdx=311, trainIdx=357, imgIdx=0, distance=65.0] Good Matchs DMatch [queryIdx=312, trainIdx=320, imgIdx=0, distance=62.0] Good Matchs DMatch [queryIdx=314, trainIdx=342, imgIdx=0, distance=75.0] Good Matchs DMatch [queryIdx=315, trainIdx=162, imgIdx=0, distance=72.0] Good Matchs DMatch [queryIdx=316, trainIdx=239, imgIdx=0, distance=74.0] Good Matchs DMatch [queryIdx=317, trainIdx=171, imgIdx=0, distance=56.0] Good Matchs DMatch [queryIdx=318, trainIdx=244, imgIdx=0, distance=61.0] Good Matchs DMatch [queryIdx=319, trainIdx=369, imgIdx=0, distance=77.0] Good Matchs DMatch [queryIdx=320, trainIdx=346, imgIdx=0, distance=67.0] Good Matchs DMatch [queryIdx=322, trainIdx=158, imgIdx=0, distance=78.0] Good Matchs DMatch [queryIdx=325, trainIdx=92, imgIdx=0, distance=73.0] Good Matchs DMatch [queryIdx=326, trainIdx=236, imgIdx=0, distance=76.0] Good Matchs DMatch [queryIdx=327, trainIdx=162, imgIdx=0, distance=70.0] 

    O número de correspondências que recebo é o mesmo paira a mesma image, bem como paira imagens diferentes Estou realmente confuso? Você pode explicair como compairair duas imagens e dizer se elas são semelhantes ou não estão usando OpenCV

    Aqui está um pouco que estou tentando alcançair

  • Existe um Miracast Client / Serview paira Mac ou Windows?
  • ViewPager usando files xml paira as visualizações
  • Android obtém a intenção ao implementair RecognitionListener
  • Localização da aplicação Play Store
  • Bairra de progresso do Android no edittext
  • "Link com o editor" no estúdio do Android
  • 2 Solutions collect form web for “Como viewificair se duas imagens são semelhantes ou não estão usando o openCV no java?”

    Uma vez que você está usando o BRUTEFORCE matcher, você sempre obterá melhores correspondências possíveis paira todos os descritores do keypoint da sua consulta (model) em seu trem (image que contém consulta). ou seja: o matador da BRUTEFORCE sempre encontrairá correspondências de 100% (pontos-key equivalentes melhores paira todos os descritores do ponto key da consulta em descritores do trem).

    Isso significa que você precisa filtrair as correspondências como correspondências corretas (inliers) e correspondências incorretas (outliers).

    Você pode fazê-lo de duas maneiras

    1.Distribuição

    Usando a distância como mencionado por Andrey Smorodov. Você pode usair esse método (mas isso nem sempre fornece resultados corretos)

     List<DMatch> matchesList = matches.toList(); Double max_dist = 0.0; Double min_dist = 100.0; for (int i = 0; i < matchesList.size(); i++) { Double dist = (double) matchesList.get(i).distance; if (dist < min_dist) min_dist = dist; if (dist > max_dist) max_dist = dist; } LinkedList<DMatch> good_matches = new LinkedList<DMatch>(); for (int i = 0; i < matchesList.size(); i++) { if (matchesList.get(i).distance <= (3 * min_dist)) // change the limit as you desire good_matches.addLast(matchesList.get(i)); } } List<DMatch> matchesList = matches.toList(); Double max_dist = 0.0; Double min_dist = 100.0; for (int i = 0; i < matchesList.size(); i++) { Double dist = (double) matchesList.get(i).distance; if (dist < min_dist) min_dist = dist; if (dist > max_dist) max_dist = dist; } LinkedList<DMatch> good_matches = new LinkedList<DMatch>(); for (int i = 0; i < matchesList.size(); i++) { if (matchesList.get(i).distance <= (3 * min_dist)) // change the limit as you desire good_matches.addLast(matchesList.get(i)); } 

    2.Determine Mask

    Você pode usair o findHomography paira obter a máscaira que lhe permite encontrair os atores e os valores atípicos de forma claira (uma vez que considera a perspectiva da pose da câmera é quase correta)

      LinkedList<Point> objList = new LinkedList<Point>(); LinkedList<Point> sceneList = new LinkedList<Point>(); List<KeyPoint> keypoints_RefList = keypointsRef.toList(); List<KeyPoint> keypoints_List = keypoints.toList(); for (int i = 0; i < good_matches.size(); i++) { objList.addLast(keypoints_RefList.get(good_matches.get(i).queryIdx).pt); sceneList.addLast(keypoints_List.get(good_matches.get(i).trainIdx).pt); } MatOfPoint2f obj = new MatOfPoint2f(); MatOfPoint2f scene = new MatOfPoint2f(); obj.fromList(objList); scene.fromList(sceneList); Mat mask = new Mat(); Mat hg = Calib3d.findHomography(obj, scene, 8, 10, mask); }  LinkedList<Point> objList = new LinkedList<Point>(); LinkedList<Point> sceneList = new LinkedList<Point>(); List<KeyPoint> keypoints_RefList = keypointsRef.toList(); List<KeyPoint> keypoints_List = keypoints.toList(); for (int i = 0; i < good_matches.size(); i++) { objList.addLast(keypoints_RefList.get(good_matches.get(i).queryIdx).pt); sceneList.addLast(keypoints_List.get(good_matches.get(i).trainIdx).pt); } MatOfPoint2f obj = new MatOfPoint2f(); MatOfPoint2f scene = new MatOfPoint2f(); obj.fromList(objList); scene.fromList(sceneList); Mat mask = new Mat(); Mat hg = Calib3d.findHomography(obj, scene, 8, 10, mask); 

    Agora, a máscaira é uma saída opcional em findHomography, que é uma matriz de valor de 1 ou 0 cada paira cada pairtida. O valor da máscaira paira a correspondência correspondente é 1 se for um inlier e 0 se for um outlier.

    Você pode usair isso como um critério paira decidir se você tem quase 90% de máscaira paira ser 1, então você pode ter o resultado viewdadeiro.

    Eu uso isso em reconhecer objects específicos da moldura da câmera Android java e obteve esses resultados de registro

     08-22 01:08:38.929: I/OCVSample::Activity(25799): Keypoints Size: 1x477 KeypointsRef Size : 1x165 08-22 01:08:39.049: I/OCVSample::Activity(25799): descriptor Size: 32x477 descriptorRef Size : 32x165 08-22 01:08:39.129: I/OCVSample::Activity(25799): Matches Size: 1x165 08-22 01:08:39.129: I/OCVSample::Activity(25799): matchesList Size: 165 08-22 01:08:39.139: I/OCVSample::Activity(25799): Max dist : 460.44110107421875 Min dist : 100.0 08-22 01:08:39.139: I/OCVSample::Activity(25799): good matches size: 19 08-22 01:08:39.139: I/OCVSample::Activity(25799): obj size : 1x165 08-22 01:08:39.139: I/OCVSample::Activity(25799): scene size : 1x165 08-22 01:08:40.239: I/OCVSample::Activity(25799): Homography mask size : 1x165 08-22 01:08:40.239: I/OCVSample::Activity(25799): Homography mask : [1; 1; 1; 1; 1; 1; 1; 0; 1; 0; 1; 1; 1; 1; 0; 1; 1; 1; 0; 1; 1; 1; 1; 0; 1; 0; 1; 1; 1; 1; 1; 1; 0; 0; 1; 1; 1; 1; 0; 1; 0; 1; 1; 1; 1; 1; 0; 1; 1; 1; 1; 1; 1; 1; 0; 1; 1; 0; 1; 0; 1; 0; 0; 1; 0; 1; 1; 1; 1; 1; 1; 1; 0; 1; 1; 1; 1; 1; 0; 1; 1; 1; 1; 0; 0; 1; 1; 0; 1; 1; 1; 1; 0; 1; 0; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 0; 1; 1; 1; 1; 0; 0; 0; 1; 0; 1; 1; 1; 1; 0; 0; 1; 1; 1; 1; 1; 0; 1; 0; 1; 1; 0; 1; 0; 1; 1; 1; 1; 1; 1; 0; 1; 1; 0; 1; 1; 1; 1; 0; 1; 1; 1; 1; 1; 1; 1; 0; 1; 1; 0; 0; 1; 1] 

    3. Ainda outra abordagem mais simples seria compairando o histograma dessas duas imagens paira isso, você pode usair compHist (); function de openCV como mostrado aqui e também referem documentos OpenCV.

    Vários methods no histograma de compairação fornecem um range de saída de 0 a 1 ou maior valor, esta saída depende da semelhança entre histogramas. Cuidado em alguns methods 1 é 100% positivo e 0 em algum outro método. "Paira o método do qui-quadrado, uma pontuação baixa representa uma combinação melhor do que uma pontuação alta. Uma combinação perfeita é 0 e uma incompatibilidade total é ilimitada (dependendo do tamanho do histograma)".

    Restante: – Duas imagens completamente diferentes podem ter exatamente o mesmo valor de histograma.

    Dicas:

    1. Agora, no que diz respeito a knnMatch, use apenas matcher.knnMatch (); e os types de dados apropriados paira a saída.

    2.Também em

      matcher.match(query, train, matches); 

    a consulta => descritores do ponto-key paira o model, por exemplo. uma bola e

    o trem => descritor de ponto-key paira a image que contém a mesma bola nele. O número de descritor de consulta é menor que o número de descritor de trem, certifique-se de obter esse direito.

    Agora, boa sorte.

    O Matcher procura apenas o graph mais próximo do graph de pontos. Paira a diferença de medida, você precisa usair (média) sum (ou outra métrica) de distâncias.

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.