Content-Based Image Retrieval Plugin for Elasticsearch. It allows users to index images and search for similar images. 

The Image Plugin is a Content-Based Image Retrieval Plugin for Elasticsearch using LIRE (Lucene Image Retrieval). It allows users to index images and search for similar images.

elasticsearch image search engine

It adds an image field type and an image query

See http://demo.elasticsearch-image.com for a demo of the plugin

In order to install the plugin, simply run: 

bin/plugin -install com.github.kzwang/elasticsearch-image/1.2.0

Example

Create Mapping

curl -XPUT 'localhost:9200/test/test/_mapping' -d '{
    "test": {
        "properties": {
            "my_img": {
                "type": "image",
                "feature": {
                    "CEDD": {
                        "hash": "BIT_SAMPLING"
                    },
                    "JCD": {
                        "hash": ["BIT_SAMPLING", "LSH"]
                    },
                    "FCTH": {}
                },
                "metadata": {
                    "jpeg.image_width": {
                        "type": "string",
                        "store": "yes"
                    },
                    "jpeg.image_height": {
                        "type": "string",
                        "store": "yes"
                    }
                }
            }
        }
    }
}'

type should be image. Mandatory

feature is a map of features for index. Mandatory, at least one is required

hash can be set if you want to search on hash. Optional

metadata is a map of metadata for index, only those metadata will be indexed. See Metadata. Optional

Index Image

curl -XPOST 'localhost:9200/test/test' -d '{
    "my_img": "... base64 encoded image ..."
}'

Search Image

curl -XPOST 'localhost:9200/test/test/_search' -d '{
    "query": {
        "image": {
            "my_img": {
                "feature": "CEDD",
                "image": "... base64 encoded image to search ...",
                "hash": "BIT_SAMPLING",
                "boost": 2.1,
                "limit": 100
            }
        }
    }
}'

feature should be one of the features in the mapping. Mandatory

image base64 of image to search. Optional if search using existing image

hash should be same to the hash set in mapping. Optional

limit limit the number of results returned (per shard) for scoring. Optional, only works when hash is specified

boost score boost Optional

Search Image using the existing image in the index

curl -XPOST 'localhost:9200/test/test/_search' -d '{
    "query": {
        "image": {
            "my_img": {
                "feature": "CEDD",
                "index": "test",
                "type": "test",
                "id": "image1",
                "path": "my_image",
                "hash": "BIT_SAMPLING"
            }
        }
    }
}'

index the index to fetch image from. Default to current index. Optional

type the type to fetch image from. Mandatory

id the id of the document to fetch image from. Mandatory

path the field specified as path to fetch image from. Mandatory

routing a custom routing value to be used when retrieving the external image doc. Optional

 

Metadata

Metadata are extracted using metadata-extractor. See SampleOutput for some examples of metadata.

The field name in index will be directory.tag_name, all lower case and space becomes underscore(_). e.g. if the Directory is JPEG and Tag Name is Image Height, the field name will be jpeg.image_height

Supported Image Formats

Images are processed by Java ImageIO, supported formats can be found here

Additional formats can be supported by ImageIO plugins, for example TwelveMonkeys

Supported Features

AUTO_COLOR_CORRELOGRAM, BINARY_PATTERNS_PYRAMID, CEDD, SIMPLE_COLOR_HISTOGRAM, COLOR_LAYOUT, EDGE_HISTOGRAM, FCTH, GABOR, JCD, JOINT_HISTOGRAM, JPEG_COEFFICIENT_HISTOGRAM, LOCAL_BINARY_PATTERNS, LUMINANCE_LAYOUT, OPPONENT_HISTOGRAM, PHOG, ROTATION_INVARIANT_LOCAL_BINARY_PATTERNS, SCALABLE_COLOR, TAMURA

Supported Hash Mode

BIT_SAMPLING, LSH

Hash will increase search speed with large data sets

See Large image data sets with LIRE ?some new numbers

Settings

SettingDescriptionDefault
index.image.use_thread_pooluse multiple thread when multiple features are requiredTrue
index.image.ignore_metadata_errorignore errors happened during extract metadata from imageTrue

 

You can also create your own image search engine using expertrec. (price- 9 USD Per month)

  1. Go to image search engine creator.
  2. Enter your website URL.
  3. Choose your nearest data center.
  4. Enable image search to on.
  5. Initiate crawl.
  6. Check out your image search demo.
  7. Take live.

muthali ganesh

Muthali loves writing about emerging technologies and easy solutions for complex tech issues. You can reach out to him through chat or by raising a support ticket on the left hand side of the page.

You may also like