The reverse image search is an analysis process when source image set containing at least one image is compared with several other images. As a result of this comparison, we get a list of most similar images according to the following conditions:
- Degree of similarity
- The minimal threshold of similarity
- Algorithm of comparison
Aspose.Imaging Cloud provides REST APIs to help developers perform a reverse image search.
There may be a lot of use cases to apply reverse image search engine. The most common use cases are the following:
- Search for image duplicates and remove the duplicates. This is the most common use of the library, and many customers need to sort out their photo libraries by finding similar photo images and leaving one or several shots while deleting the rest ones.
- Search for content similar images. This feature is useful for digital writers who wish to find the most suitable content image to fill the article. Sometimes they may want to find a higher resolution image with the same content to put into article.
- Search for inappropriate content. The engine may help find and identify images with inappropriate content and filter them out.
- Search for digitally signed images.
Find Duplicate Images
With Aspose.Imaging REST API, we can find duplicate images in images storage. The steps to call this API are following:
1. Create ImagingApi Instance
2. Create Image Search
The method creates empty search context with certain settings. The search context state is stored in storage as a file (searchContextId).search. The important API parameters are:
- String detector - features detector (default AKAZE)
- String matchingAlgorithm – features matching algorithm (default RandomBinaryTree)
The API returns SearchContextStatus in response which indicates the current status of search context: Idle, ExtractingFeatures, MatchingFeatures or Searching.
3. Upload Image Set to Cloud Storage
Now, we upload the image set to cloud storage among whom we want to find duplicate images.
4. Add Images to Search Context
Now, we extract features of the above images and add them to search context.
5. Call Find Image Duplicates API
Finally, we call FindImageDuplicates API and pass following parameters:
- searchContextId - search context id
- similarityThreshold (required) – minimum similarity threshold
The API returns Duplicates(ImageDuplicates) array. The array contains property SearchResult DuplicateImages. The Search result contains two properties: string ImageId and float Similarity.
We may delete the search context as a last step.