Вопрос

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

Это было полезно?

Решение

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);
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top