Condense a discrete function (histogram) in a single value
Basically I need to store (in a database) and subsequently fast compare histograms of two images.
Let's say I have an image and the green histograms is:
Where basically I have 4 buckects, and green pixel from 0 to 63 are 15 and so on.
How could I condense this graph in a numeric value so I can easly compare it to a new image?
The most simple solution is to create a string like this:
15.12.22.9
^ ^
>--|--------number of pixel from 0-64
>--------number of pixel from 64-127
(and so on)
The problem with this solution is that i can't easly compare 2 images with similar value. Let's say I have another images with the green histogram is:
14.12.22.9
^
> 14 pixel instead of 15
This new image is basically the same with just 1 pixel less of 0-63 range. But I can't easly compare this 2 strings
functions
add a comment |
Basically I need to store (in a database) and subsequently fast compare histograms of two images.
Let's say I have an image and the green histograms is:
Where basically I have 4 buckects, and green pixel from 0 to 63 are 15 and so on.
How could I condense this graph in a numeric value so I can easly compare it to a new image?
The most simple solution is to create a string like this:
15.12.22.9
^ ^
>--|--------number of pixel from 0-64
>--------number of pixel from 64-127
(and so on)
The problem with this solution is that i can't easly compare 2 images with similar value. Let's say I have another images with the green histogram is:
14.12.22.9
^
> 14 pixel instead of 15
This new image is basically the same with just 1 pixel less of 0-63 range. But I can't easly compare this 2 strings
functions
1
> How could I condense this graph in a numeric value so I can easly compare it to a new image? Just store the tuple of 4 numbers. What's wrong with that? the 4 numbers occupy less space than a string, and are easier to compare.
– leonbloy
Jun 1 '12 at 21:04
@leonbloy: that would lock the database table to a given number of buckets, i would avoid that
– dynamic
Jun 1 '12 at 21:24
And, consider for example we choose 50 buckets for each channel (RGB), that would mean a table with 150 field on the table. Not good
– dynamic
Jun 1 '12 at 21:27
add a comment |
Basically I need to store (in a database) and subsequently fast compare histograms of two images.
Let's say I have an image and the green histograms is:
Where basically I have 4 buckects, and green pixel from 0 to 63 are 15 and so on.
How could I condense this graph in a numeric value so I can easly compare it to a new image?
The most simple solution is to create a string like this:
15.12.22.9
^ ^
>--|--------number of pixel from 0-64
>--------number of pixel from 64-127
(and so on)
The problem with this solution is that i can't easly compare 2 images with similar value. Let's say I have another images with the green histogram is:
14.12.22.9
^
> 14 pixel instead of 15
This new image is basically the same with just 1 pixel less of 0-63 range. But I can't easly compare this 2 strings
functions
Basically I need to store (in a database) and subsequently fast compare histograms of two images.
Let's say I have an image and the green histograms is:
Where basically I have 4 buckects, and green pixel from 0 to 63 are 15 and so on.
How could I condense this graph in a numeric value so I can easly compare it to a new image?
The most simple solution is to create a string like this:
15.12.22.9
^ ^
>--|--------number of pixel from 0-64
>--------number of pixel from 64-127
(and so on)
The problem with this solution is that i can't easly compare 2 images with similar value. Let's say I have another images with the green histogram is:
14.12.22.9
^
> 14 pixel instead of 15
This new image is basically the same with just 1 pixel less of 0-63 range. But I can't easly compare this 2 strings
functions
functions
edited 2 days ago
Glorfindel
3,41981830
3,41981830
asked Jun 1 '12 at 20:48
dynamicdynamic
1608
1608
1
> How could I condense this graph in a numeric value so I can easly compare it to a new image? Just store the tuple of 4 numbers. What's wrong with that? the 4 numbers occupy less space than a string, and are easier to compare.
– leonbloy
Jun 1 '12 at 21:04
@leonbloy: that would lock the database table to a given number of buckets, i would avoid that
– dynamic
Jun 1 '12 at 21:24
And, consider for example we choose 50 buckets for each channel (RGB), that would mean a table with 150 field on the table. Not good
– dynamic
Jun 1 '12 at 21:27
add a comment |
1
> How could I condense this graph in a numeric value so I can easly compare it to a new image? Just store the tuple of 4 numbers. What's wrong with that? the 4 numbers occupy less space than a string, and are easier to compare.
– leonbloy
Jun 1 '12 at 21:04
@leonbloy: that would lock the database table to a given number of buckets, i would avoid that
– dynamic
Jun 1 '12 at 21:24
And, consider for example we choose 50 buckets for each channel (RGB), that would mean a table with 150 field on the table. Not good
– dynamic
Jun 1 '12 at 21:27
1
1
> How could I condense this graph in a numeric value so I can easly compare it to a new image? Just store the tuple of 4 numbers. What's wrong with that? the 4 numbers occupy less space than a string, and are easier to compare.
– leonbloy
Jun 1 '12 at 21:04
> How could I condense this graph in a numeric value so I can easly compare it to a new image? Just store the tuple of 4 numbers. What's wrong with that? the 4 numbers occupy less space than a string, and are easier to compare.
– leonbloy
Jun 1 '12 at 21:04
@leonbloy: that would lock the database table to a given number of buckets, i would avoid that
– dynamic
Jun 1 '12 at 21:24
@leonbloy: that would lock the database table to a given number of buckets, i would avoid that
– dynamic
Jun 1 '12 at 21:24
And, consider for example we choose 50 buckets for each channel (RGB), that would mean a table with 150 field on the table. Not good
– dynamic
Jun 1 '12 at 21:27
And, consider for example we choose 50 buckets for each channel (RGB), that would mean a table with 150 field on the table. Not good
– dynamic
Jun 1 '12 at 21:27
add a comment |
1 Answer
1
active
oldest
votes
Some options:
- Store the full information, eg as a array of numbers (if your DB supports some ARRAY datatype), or as a hexadecimal string, or a JSON string, or whatever representation that suits you (but not "a numeric value", that does not make much sense)
- Depending on what you consider to be a good measure of similarity, you could store, say, three numbers per channel (what would correspond to a decimated 3-buckets histogram)
The advantage of 1 is that you retain the full information and coul do a good comparison. The disadvantage is that it might be difficult to do compute the difference, specially inside the database, specially for varying number of buckets.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f152627%2fcondense-a-discrete-function-histogram-in-a-single-value%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Some options:
- Store the full information, eg as a array of numbers (if your DB supports some ARRAY datatype), or as a hexadecimal string, or a JSON string, or whatever representation that suits you (but not "a numeric value", that does not make much sense)
- Depending on what you consider to be a good measure of similarity, you could store, say, three numbers per channel (what would correspond to a decimated 3-buckets histogram)
The advantage of 1 is that you retain the full information and coul do a good comparison. The disadvantage is that it might be difficult to do compute the difference, specially inside the database, specially for varying number of buckets.
add a comment |
Some options:
- Store the full information, eg as a array of numbers (if your DB supports some ARRAY datatype), or as a hexadecimal string, or a JSON string, or whatever representation that suits you (but not "a numeric value", that does not make much sense)
- Depending on what you consider to be a good measure of similarity, you could store, say, three numbers per channel (what would correspond to a decimated 3-buckets histogram)
The advantage of 1 is that you retain the full information and coul do a good comparison. The disadvantage is that it might be difficult to do compute the difference, specially inside the database, specially for varying number of buckets.
add a comment |
Some options:
- Store the full information, eg as a array of numbers (if your DB supports some ARRAY datatype), or as a hexadecimal string, or a JSON string, or whatever representation that suits you (but not "a numeric value", that does not make much sense)
- Depending on what you consider to be a good measure of similarity, you could store, say, three numbers per channel (what would correspond to a decimated 3-buckets histogram)
The advantage of 1 is that you retain the full information and coul do a good comparison. The disadvantage is that it might be difficult to do compute the difference, specially inside the database, specially for varying number of buckets.
Some options:
- Store the full information, eg as a array of numbers (if your DB supports some ARRAY datatype), or as a hexadecimal string, or a JSON string, or whatever representation that suits you (but not "a numeric value", that does not make much sense)
- Depending on what you consider to be a good measure of similarity, you could store, say, three numbers per channel (what would correspond to a decimated 3-buckets histogram)
The advantage of 1 is that you retain the full information and coul do a good comparison. The disadvantage is that it might be difficult to do compute the difference, specially inside the database, specially for varying number of buckets.
answered Jun 1 '12 at 21:48
leonbloyleonbloy
40.5k645107
40.5k645107
add a comment |
add a comment |
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f152627%2fcondense-a-discrete-function-histogram-in-a-single-value%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
> How could I condense this graph in a numeric value so I can easly compare it to a new image? Just store the tuple of 4 numbers. What's wrong with that? the 4 numbers occupy less space than a string, and are easier to compare.
– leonbloy
Jun 1 '12 at 21:04
@leonbloy: that would lock the database table to a given number of buckets, i would avoid that
– dynamic
Jun 1 '12 at 21:24
And, consider for example we choose 50 buckets for each channel (RGB), that would mean a table with 150 field on the table. Not good
– dynamic
Jun 1 '12 at 21:27