【问题标题】:Google custom search api search images by imageGoogle 自定义搜索 api 按图片搜索图片
【发布时间】:2015-02-09 13:38:42
【问题描述】:

我可以使用 Google 自定义搜索引擎从 Java 项目中获取 Json 格式的图像结果。然后我从 Json 文件中获取图像链接,并显示来自 android 应用程序的图像。我想以某种方式过滤我向我的 android 应用程序显示的内容。

所以我想通过图片 url 搜索图片并以 Json 格式获得相似的图片结果。我知道 Google 图片搜索 api,但它已被弃用。我也知道 tineye api,但它需要付款,我更喜欢开源的。

有没有办法通过图片url搜索图片并得到Json格式的结果?

【问题讨论】:

  • 我还需要 Google 按图片搜索(反向图片搜索)作为官方 API。

标签: java android json google-custom-search google-image-search


【解决方案1】:

不确定您的问题 - 但谷歌自定义搜索引擎可以返回图像结果:例如对于 java 的搜索查询,只有文件类型 .png 的结果

String newURL = "https://www.googleapis.com/customsearch/v1?key=<YOUR API KEY>&cx=<your google custom search engine>&q=java&as_filetype=png";

// Create a new RestTemplate instance
RestTemplate restTemplate = new RestTemplate();

// Add the String message converter
restTemplate.getMessageConverters().add(new StringHttpMessageConverter());

// Make the HTTP GET request, marshaling the response to a String
String googleRestResult = restTemplate.getForObject(newURL, String.class, "Android");

查看详情 https://developers.google.com/custom-search/docs/xml_results#startsp

【讨论】:

  • 我的问题是关于反向图像搜索。例如通过图像搜索图像并获得相似的图像结果为json。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-12-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多