how to match two images [closed]
Hello,
I am develop an application in android two compare or match two images and draw the line when same image is detected.
here is following is my code :-
OpenCvCameraView.enableView();
detector = FeatureDetector.create(FeatureDetector.AKAZE);
descriptor = DescriptorExtractor.create(DescriptorExtractor.AKAZE);
matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING);
img1 = new Mat();
AssetManager assetManager = getAssets();
InputStream istr = assetManager.open("background.jpeg");
Bitmap bitmap = BitmapFactory.decodeStream(istr);
Utils.bitmapToMat(bitmap, img1);
Imgproc.cvtColor(img1, img1, Imgproc.COLOR_RGB2GRAY);
img1.convertTo(img1, 0); //converting the image to match with the type of the cameras image
descriptors1 = new Mat();
keypoints1 = new MatOfKeyPoint();
detector.detect(img1, keypoints1);
descriptor.compute(img1, keypoints1, descriptors1);
above snippet of code is right what actual problem you face?
actually it's working fine but sometime it's draw no of lines above on both images.
are you trying to compare arbitrary images for similarity ?
what is the purpose of your program ? what is the input data ?
(now please don't say "compare images". that's far too broad !)
@berak no i am simple input .jpeg format data and find the match between two images
have a look here again -- it says , for a known object.
if you wanted to find out, if it is the same or not, you are on the wrong bus. (it is impossible like this)
@berak ok thanks for guide me
ok, it's not impossible, but much harder than you might think now.
please do a bit of reseach on CBIR, clustering, BagOfWords, VLAD
and again, why are you trying to compare those images ?