question

AbhijithChandran-2966 avatar image
0 Votes"
AbhijithChandran-2966 asked romungi-MSFT commented

How to get same (not similar) images with Bing Visual Search API?

I am trying to find where all the same image has come. For example if I have the URL to an image A, what all websites does image A appear. I tried using the Bing Visual Search API, however, it shows me similar images. Here is the code I use:

 IMG_URL = '<IMAGE URL>'
 url_struct  = '{"imageInfo":{"url":"' + IMG_URL + '"}}'
    
 headers = {
     'Ocp-Apim-Subscription-Key': '<API-KEY>',
 }
    
 params = (
     ('mkt', 'en-us'),
 )
    
 files = {
     'knowledgeRequest': (None, url_struct),
 }
    
 response = requests.post('https://api.bing.microsoft.com/v7.0/images/visualsearch', headers=headers, params=params, files=files)

I know for sure that the same image appears at at least one other place. What should i do to get the same image and not similar ones?

azure-bing-imageazure-bing-visual
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

romungi-MSFT avatar image
0 Votes"
romungi-MSFT answered

@AbhijithChandran-2966 I have tried this scenario with some images and found that the pages that include the same image are available in the object 'actionType': 'PagesIncluding' in the response JSON.

This is similar to what you see in the demo page for a test image i uploaded.

  'tags': [{'actions': [{'_type': 'ImageModuleAction',
                         'actionType': 'PagesIncluding',
                         'data': {'value': [{'accentColor': '724534',
                                             'contentSize': '44196 B',
                                             'contentUrl': 'https://telugu.cdn.zeenews.com/telugu/sites/default/files/2018/09/30/174655-naiduaug27.jpg',

103357-image.png




image.png (338.5 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AbhijithChandran-2966 avatar image
0 Votes"
AbhijithChandran-2966 answered romungi-MSFT commented

@romungi-MSFT Thanks!

However, here is an example of an image that I searched for. The "Pages with this" shows images that have the image but not the stock/template but the meme with an overlay of text or other modifications. I know that the input image does appear at other places in the exact form without any modifications. Is this expected behaviour or can I do something to change it?

103689-screenshot-2021-06-09-at-105724-am.png



· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@AbhijithChandran-2966 With respect to text in the image, I think the response should have the field TextLine but it is missing in the images. I have tested this with input images that contain/does not contain inline text. I will have to check with the product group internally to understand if this is expected behavior.


0 Votes 0 ·