Content-Based Image Retrieval Plugin for Elasticsearch. It allows users to index images and search for similar images. http://demo.elasticsearch-image.com/
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.
It adds a image
field type and a image
query
See http://demo.elasticsearch-image.com for a demo of the plugin
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 the hash. Optional
metadata
is a map of metadata for the 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 the image to search. Optional if search using existing image
hash
should be the 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 the 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 is 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
Hash will increase search speed with large data sets
See Large image data sets with LIRE ?some new numbers
Settings
Setting | Description | Default |
---|---|---|
index.image.use_thread_pool | use multiple thread when multiple features are required | True |
index.image.ignore_metadata_error | ignore errors happened during extract metadata from image | True |
You can also create your own image search engine using expertrec. (price- 9 USD Per month)
- Go to image search engine creator.
- Enter your website URL.
- Choose your nearest data center.
- Enable image search to on.
- Initiate crawl.
- Check out your image search demo.
- Take live.