Is it possible to compare an image with a list of images? [google-cloud-vision]

那年仲夏 提交于 2020-03-05 05:09:35

问题


I'm trying to compare one dog image with a bucket full of dog images and get their similarity, does anybody have some clue to do that?


回答1:


You could try out Vision API's ProductSearch: https://cloud.google.com/vision/product-search/docs/

You build a ProductSet of Products. You add reference images to each Product. Later, you send a query image in and it will return the most visually similar results in your ProductSet.




回答2:


You can use my Ruby gem that implementes two perceptual image hashing to calculate the image similarity.

require "dhash-vips"

hash0 = DHashVips::IDHash.fingerprint "dog.jpg"

hash1 = DHashVips::IDHash.fingerprint "dog1.jpg"
hash2 = DHashVips::IDHash.fingerprint "dog2.jpg"

puts "dog1 is this much different: #{DHashVips::IDHash.distance hash0, hash1}"
puts "dog2 is this much different: #{DHashVips::IDHash.distance hash0, hash2}"


来源:https://stackoverflow.com/questions/58401906/is-it-possible-to-compare-an-image-with-a-list-of-images-google-cloud-vision

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!