elasticsearch-image

Image Plugin for ElasticSearch

License

License

Categories

Categories

Search Business Logic Libraries Elasticsearch
GroupId

GroupId

com.github.kzwang
ArtifactId

ArtifactId

elasticsearch-image
Last Version

Last Version

1.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

elasticsearch-image
Image Plugin for ElasticSearch
Project URL

Project URL

http://github.com/kzwang/elasticsearch-image
Source Code Management

Source Code Management

http://github.com/kzwang/elasticsearch-image

Download elasticsearch-image

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.kzwang/elasticsearch-image/ -->
<dependency>
    <groupId>com.github.kzwang</groupId>
    <artifactId>elasticsearch-image</artifactId>
    <version>1.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.kzwang/elasticsearch-image/
implementation 'com.github.kzwang:elasticsearch-image:1.2.0'
// https://jarcasting.com/artifacts/com.github.kzwang/elasticsearch-image/
implementation ("com.github.kzwang:elasticsearch-image:1.2.0")
'com.github.kzwang:elasticsearch-image:jar:1.2.0'
<dependency org="com.github.kzwang" name="elasticsearch-image" rev="1.2.0">
  <artifact name="elasticsearch-image" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.kzwang', module='elasticsearch-image', version='1.2.0')
)
libraryDependencies += "com.github.kzwang" % "elasticsearch-image" % "1.2.0"
[com.github.kzwang/elasticsearch-image "1.2.0"]

Dependencies

compile (4)

Group / Artifact Type Version
org.elasticsearch : elasticsearch jar 1.0.1
com.github.kzwang : lire jar 0.9.4-kzwang-beta1
com.twelvemonkeys.imageio : imageio-jpeg jar 3.0-rc5
com.drewnoakes : metadata-extractor jar 2.6.2

test (6)

Group / Artifact Type Version
org.apache.lucene : lucene-test-framework jar 4.6.1
log4j : log4j jar 1.2.17
org.elasticsearch : elasticsearch test-jar 1.0.1
org.hamcrest : hamcrest-all jar 1.3
org.apache.sanselan : sanselan jar 0.97-incubator
com.twelvemonkeys.imageio : imageio-tiff jar 3.0-rc5

Project Modules

There are no modules declared in this project.

Image Plugin for Elasticsearch

Build Status

The Image Plugin is an 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 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.

Image Plugin elasticsearch Release date
1.3.0-SNAPSHOT (master) 1.1.0
1.2.0 1.0.1 2014-03-20
1.1.0 1.0.1 2014-03-13
1.0.0 1.0.1 2014-03-05

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 existing image in 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

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

ChangeLog

1.2.0 (2014-03-20)

  • Use multi-thread when multiple features are required to improve index speed
  • Allow index metadata
  • Allow query by existing image in index

1.1.0 (2014-03-13)

  • Added limit in image query
  • Added plugin version in es-plugin.properties

1.0.0 (2014-03-05)

  • initial release

Versions

Version
1.2.0
1.1.0
1.0.0