Condense a discrete function (histogram) in a single value












0














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










share|cite|improve this question




















  • 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
















0














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










share|cite|improve this question




















  • 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














0












0








0







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










share|cite|improve this question















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






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








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














  • 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










1 Answer
1






active

oldest

votes


















1














Some options:




  1. 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)

  2. 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.






share|cite|improve this answer





















    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
    });


    }
    });














    draft saved

    draft discarded


















    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









    1














    Some options:




    1. 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)

    2. 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.






    share|cite|improve this answer


























      1














      Some options:




      1. 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)

      2. 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.






      share|cite|improve this answer
























        1












        1








        1






        Some options:




        1. 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)

        2. 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.






        share|cite|improve this answer












        Some options:




        1. 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)

        2. 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.







        share|cite|improve this answer












        share|cite|improve this answer



        share|cite|improve this answer










        answered Jun 1 '12 at 21:48









        leonbloyleonbloy

        40.5k645107




        40.5k645107






























            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Mario Kart Wii

            The Binding of Isaac: Rebirth/Afterbirth

            What does “Dominus providebit” mean?