How to integrate Impresee Search API v3

This document describes how you can integrate Impresee visual search services into your online store.

 

Previous Steps

  • Obtain an Impresee application UUID this is a string with 36 characters. This code can be generated in the Impresee Console or you can ask us to generate one for you.
  • Get a jpg image to test the integration (for more details see image recommendations section).

Request

Impresee’s image based search service is a REST service that takes a text and/or a query image and searches inside one or more catalogs. The service can be called by sending a POST request to the URL:

https://api.impresee.com/ImpreseeSearch/api/v3/search/text/<your_impresee_application_UUID>

The body of this request is a JSON:

1. For search by image:

  • query_image: A JSON with a image_base64 parameter, which is the query image encoded in base64 format.

An example of this JSON can be seen below

{
"query_image": { "image_base64": "/9j/4AAQSkZJRgABAQAAAwADAAD/4QCMRXhpZgAATU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAAB/AAAAMgAAAH8AAAAyAAOgAQADAAAAAQABAACgAgAEAAAAAQAAAAGgAwAEAAAAAQAAAAEAAAAA/+0AOFBob3Rvc2hvcCAzLjAAOEJJTQQEAAAAAAAAOEJJTQQlAAAAAAAQ1B2M2Y8AsgTpgAmY7PhCfv/AABEIAAEAAQMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2wBDABQODxIPDRQSEBIXFRQYHjIhHhwcHj0sLiQySUBMS0dARkVQWnNiUFVtVkVGZIhlbXd7gYKBTmCNl4x9lnN+gXz/2wBDARUXFx4aHjshITt8U0ZTfHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHz/3QAEAAH/2gAMAwEAAhEDEQA/AOMooooA/9k=" }
}

2. For search by drawing:

  • query_sketch: A JSON with a sketch_base64 parameter, which is the query sketch encoded in base64 format.

An example of this JSON can be seen below

{
"query_sketch": { "sketch_base64": "/9j/4AAQSkZJRgABAQAAAwADAAD/4QCMRXhpZgAATU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAAB/AAAAMgAAAH8AAAAyAAOgAQADAAAAAQABAACgAgAEAAAAAQAAAAGgAwAEAAAAAQAAAAEAAAAA/+0AOFBob3Rvc2hvcCAzLjAAOEJJTQQEAAAAAAAAOEJJTQQlAAAAAAAQ1B2M2Y8AsgTpgAmY7PhCfv/AABEIAAEAAQMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2wBDABQODxIPDRQSEBIXFRQYHjIhHhwcHj0sLiQySUBMS0dARkVQWnNiUFVtVkVGZIhlbXd7gYKBTmCNl4x9lnN+gXz/2wBDARUXFx4aHjshITt8U0ZTfHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHz/3QAEAAH/2gAMAwEAAhEDEQA/AOMooooA/9k=" }
}

Remember: To perform a visual search you DO NOT need to include the search_text unless you really want to search using both image and text

 

Response

 

The search service returns a JSON message with the list of products that meet the condition and the attributes to be displayed to the user.

This is a JSON response message:

Each product contains the following data:

Using your Impresee Console account you can configure the catalog attributes that will be exported to the JSON. In this way, it is possible to display extra information about each product.

Impresee provides a JavaScript library that can be easily configured to integrate the search engine with any website in no time. More details about the library for integration and how to integrate visual search can be found here.

Image Recommendations

In order to obtain both good search results and good upload times, there are two considerations that need to be taken:

  1. Size and quality of the image: A large image with high quality is usually very big (we are talking about megabytes). Uploading images of these characteristics can take too long, without bringing any advantage in terms of the quality of the search results. We recommend resizing the image and changing its quality before encoding it to base64. The recommended values are:
  • Longest side of 480 pixels.
  • Quality of 75%.

This should result in a filesize close to 50KB.

  1. The object in the query image should be centered: To obtain good search results the object that is being looked for must be in the center of the image.

Even though we apply object detection we still recommend having an image with the items in the center of the picture.