how to match two images [closed]

asked 2019-01-04 06:55:23 -0500

aniketpatidar gravatar image


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 :-

    detector = FeatureDetector.create(FeatureDetector.AKAZE);
    descriptor = DescriptorExtractor.create(DescriptorExtractor.AKAZE);
    matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING);
    img1 = new Mat();
    AssetManager assetManager = getAssets();
    InputStream istr ="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);
edit retag flag offensive reopen merge delete

Closed for the following reason spam or advertising by mshabunin
close date 2019-04-04 06:45:42.691060


above snippet of code is right what actual problem you face?

david cairns gravatar imagedavid cairns ( 2019-01-04 07:03:17 -0500 )edit

actually it's working fine but sometime it's draw no of lines above on both images.

aniketpatidar gravatar imageaniketpatidar ( 2019-01-04 07:06:02 -0500 )edit

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 gravatar imageberak ( 2019-01-04 07:06:10 -0500 )edit

@berak no i am simple input .jpeg format data and find the match between two images

aniketpatidar gravatar imageaniketpatidar ( 2019-01-04 07:09:30 -0500 )edit

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 gravatar imageberak ( 2019-01-04 07:13:02 -0500 )edit

@berak ok thanks for guide me

aniketpatidar gravatar imageaniketpatidar ( 2019-01-04 07:15:39 -0500 )edit

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 ?

berak gravatar imageberak ( 2019-01-04 07:20:17 -0500 )edit