RGB Color search

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

RGB Color search

Dan Tuffery
I have RGB color values stored in my index.

color: [
{
    red: 50
    green: 73
    blue: 93
}]

I need to be able to find documents in the index that are the the closest color to the RGB values in a request using Euclidean distance, what is the best way to achieve this in ElasticSearch?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: RGB Color search

Andrej
You could use function score query and provide calculation of distance as script, maybe?

Am Donnerstag, 17. Oktober 2013 15:35:30 UTC+2 schrieb dan:
I have RGB color values stored in my index.

color: [
{
    red: 50
    green: 73
    blue: 93
}]

I need to be able to find documents in the index that are the the closest color to the RGB values in a request using Euclidean distance, what is the best way to achieve this in ElasticSearch?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: RGB Color search

dadoonet
Hmmm. I love that use case. 
Still wondering if color should be a specific type such as geo_point?

Anyhow, I would love to hear how you implement it.

Best
-- 
David Pilato | Technical Advocate | Elasticsearch.com



Le 17 oct. 2013 à 15:59, Andrej Rosenheinrich <[hidden email]> a écrit :

You could use function score query and provide calculation of distance as script, maybe?

Am Donnerstag, 17. Oktober 2013 15:35:30 UTC+2 schrieb dan:
I have RGB color values stored in my index.

color: [
{
    red: 50
    green: 73
    blue: 93
}]

I need to be able to find documents in the index that are the the closest color to the RGB values in a request using Euclidean distance, what is the best way to achieve this in ElasticSearch?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: RGB Color search

Dan Tuffery
In reply to this post by Andrej
Thanks, this seems like a good way to do it.

I'm trying to get a simple example of the script_score working, but it seems like my syntax is wrong;

{
"query" : {
"query_string" : {
"query" : "*:*"
},
"script_score": {
"lang": "lang",
"script":"_score * 5"
}
}
}

Are there any examples anywhere?

On Thursday, October 17, 2013 2:59:23 PM UTC+1, Andrej Rosenheinrich wrote:
You could use function score query and provide calculation of distance as script, maybe?

Am Donnerstag, 17. Oktober 2013 15:35:30 UTC+2 schrieb dan:
I have RGB color values stored in my index.

color: [
{
    red: 50
    green: 73
    blue: 93
}]

I need to be able to find documents in the index that are the the closest color to the RGB values in a request using Euclidean distance, what is the best way to achieve this in ElasticSearch?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: RGB Color search

dadoonet
Have a look at function score: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html

It should help
-- 
David Pilato | Technical Advocate | Elasticsearch.com



Le 17 oct. 2013 à 21:45, dan <[hidden email]> a écrit :

Thanks, this seems like a good way to do it.

I'm trying to get a simple example of the script_score working, but it seems like my syntax is wrong;

{
"query" : {
"query_string" : {
"query" : "*:*"
},
"script_score": {
"lang": "lang",
"script":"_score * 5"
}
}
}

Are there any examples anywhere?

On Thursday, October 17, 2013 2:59:23 PM UTC+1, Andrej Rosenheinrich wrote:
You could use function score query and provide calculation of distance as script, maybe?

Am Donnerstag, 17. Oktober 2013 15:35:30 UTC+2 schrieb dan:
I have RGB color values stored in my index.

color: [
{
    red: 50
    green: 73
    blue: 93
}]

I need to be able to find documents in the index that are the the closest color to the RGB values in a request using Euclidean distance, what is the best way to achieve this in ElasticSearch?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: RGB Color search

Dan Tuffery
Thanks David, that link is giving me a 404

On Thursday, October 17, 2013 8:51:02 PM UTC+1, David Pilato wrote:
Have a look at function score: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html

It should help
-- 
David Pilato | Technical Advocate | Elasticsearch.com



Le 17 oct. 2013 à 21:45, dan <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="8L68NNDnwVMJ">dan.t...@...> a écrit :

Thanks, this seems like a good way to do it.

I'm trying to get a simple example of the script_score working, but it seems like my syntax is wrong;

{
"query" : {
"query_string" : {
"query" : "*:*"
},
"script_score": {
"lang": "lang",
"script":"_score * 5"
}
}
}

Are there any examples anywhere?

On Thursday, October 17, 2013 2:59:23 PM UTC+1, Andrej Rosenheinrich wrote:
You could use function score query and provide calculation of distance as script, maybe?

Am Donnerstag, 17. Oktober 2013 15:35:30 UTC+2 schrieb dan:
I have RGB color values stored in my index.

color: [
{
    red: 50
    green: 73
    blue: 93
}]

I need to be able to find documents in the index that are the the closest color to the RGB values in a request using Euclidean distance, what is the best way to achieve this in ElasticSearch?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="8L68NNDnwVMJ">elasticsearc...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: RGB Color search

dadoonet


--
David ;-)
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs


Le 17 oct. 2013 à 22:06, dan <[hidden email]> a écrit :

Thanks David, that link is giving me a 404

On Thursday, October 17, 2013 8:51:02 PM UTC+1, David Pilato wrote:
Have a look at function score: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html

It should help
-- 
David Pilato | Technical Advocate | Elasticsearch.com



Le 17 oct. 2013 à 21:45, dan <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="8L68NNDnwVMJ">dan.t...@...> a écrit :

Thanks, this seems like a good way to do it.

I'm trying to get a simple example of the script_score working, but it seems like my syntax is wrong;

{
"query" : {
"query_string" : {
"query" : "*:*"
},
"script_score": {
"lang": "lang",
"script":"_score * 5"
}
}
}

Are there any examples anywhere?

On Thursday, October 17, 2013 2:59:23 PM UTC+1, Andrej Rosenheinrich wrote:
You could use function score query and provide calculation of distance as script, maybe?

Am Donnerstag, 17. Oktober 2013 15:35:30 UTC+2 schrieb dan:
I have RGB color values stored in my index.

color: [
{
    red: 50
    green: 73
    blue: 93
}]

I need to be able to find documents in the index that are the the closest color to the RGB values in a request using Euclidean distance, what is the best way to achieve this in ElasticSearch?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="8L68NNDnwVMJ">elasticsearc...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: RGB Color search

Mark Harwood
In reply to this post by Dan Tuffery
There's an implementation of a colour distance algorithm here: http://compuphase.com/cmetric.htm

I coded it up as a Lucene query some time ago (don't have the source to hand currently) and results were OK but had some oddities.
I ended up thinking that a data-gathering exercise via Mechanical Turk or similar might be a useful exercise to train a better model that accounts for the quirks in human perception.

Cheers
Mark

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.