Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7494801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T17:47:07+00:00 2026-05-29T17:47:07+00:00

I am using the normalise function in the code below. My understanding was that

  • 0

I am using the normalise function in the code below. My understanding was that normalising the histogram would result in the bins summing to one? But when I add them all up I keep getting a result higher then one. I dont know if I am doing something wrong or have misunderstood what the function does?

//read in image
Mat img = imread("image.jpg",1);
vector<Mat> planes;
split(img, planes);

//calculate hist
MatND hist;
int nbins = 256; // hold 256 levels
int hsize[] = { nbins }; // one dimension
float range[] = { 0, 255 };
const float *ranges[] = { range };
int chnls[] = {0};
calcHist(&planes[0], 1, chnls, Mat(), hist,1,hsize,ranges);

//normalise
normalize(hist,hist,1);

float tot = 0;
for( int n = 0;n < nbins; n++ )
    {
        float binVal = hist.at<float>(n);
        tot+=binVal;
    }
cout<<tot;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T17:47:08+00:00Added an answer on May 29, 2026 at 5:47 pm

    Normalized array doesn’t sum to 1, but square root of sum of squares of components equals 1, F.e. in vector:

    It is normalized, when:
    sqrt(x^2 + y^2 + z^2) = 1

    *This applies for vectors

    in OpenCV – histogram – normalize is described here OpenCV histogram normalize, it should be clear (after reading the specs) that it doesn’t have to sum to 1

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Access 2007 to build a normalized database to replace one that uses
Using MySQL, i'm selecting a list of songs in spanish that i would like
I am trying to translate a function in a book into code, using MATLAB
I am using a book with a function I would like to use. However
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
I have an XML as input to a Java function that parses it and
We are using boost::filesystem in our application. I have a 'full' path that is
How come I can't use normalizer function? I am using it exactly as I
I'm using Mnesia with Erlang, but this question applies to any key-value db like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.