5

I would like to add a function to my App similar to the "Best guess" section like the pic below, what is the best way to implement such feature? Any advice will be appreciated.

Further more, since Google image search API has been deprecated, and the new custom search API doesn't seem to provide reverse image search, is there any other service that provides similar reverse image searching function?

My guess is:

  1. do a reverse image search with a search engine
  2. get the returned file names of the images
  3. analyse the returned file names, and get the most common one
  4. the most common file name should be the "best guess" for this image

Google reverse image search

Craig Zheng
  • 443
  • 1
  • 5
  • 17

1 Answers1

1

It seems that currently the only way (not the best I think) to get best guess for image is to scrape it from Google response. I tried TinEye , but it perform image search much worse than Google.

Something like the following:

String newUrl = "http://www.google.com/searchbyimage?hl=en&image_url=http://media.tumblr.com/745c48c1dcf79c51f64f69c64d0cf095/tumblr_inline_ms5a0kJVT51qz4rgp.jpg";

Document doc = Jsoup.connect(newUrl).userAgent("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.76 Safari/537.36").get();
Elements bestGuessElement = doc.select("a.qb-b");

String bestGuess = null;
if (!bestGuessElement.isEmpty() && bestGuessElement.hasText()) {
    bestGuess = bestGuessElement.text();
}
System.out.println(bestGuess);
Michael Potter
  • 530
  • 4
  • 11
  • Mr. Potter, Wht if there is no URL for the image (I guess in OP's question too) and he is uploading image from his hard drive – nobalG Aug 26 '14 at 05:19
  • @Butterflow in this case you can use 3rd party storage (e.g. dropbox, google drive, amazon cloud storage) that gives you an opportunity to share images or write such a service yourself. – Michael Potter Sep 12 '14 at 16:19