Normalizing histograms? [closed] - c++

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
What is normalizing histograms? When and why would I use it? What are its advantages?
I don't understand the concept at all- when I try to apply it to my histogram, when I use back projection, I don't get any results.
Could someone give me a non-technical explanation of normalization?
I am using OpenCV
PS: Don't send me to wikipedia- I don't understand the Wikipedia Page
Thanks

It's very simple, actually. A normalized histogram is one in which the sum of the frequencies is exactly 1. Therefore, if you express each frequency as a percentage of the total, you get a normalized histogram.
What is the use of a normalized histogram? Well, if you studied probability and/or statistics, you might know that one property required for a function to be a probability distribution for a random variable is that the total area under the curve is 1. That's for continuous-variable functions. For discrete functions, the requirements is that the sum of all values of the function is 1. So a normalized histogram can be thought of a probability distribution function which shows how probable each of the values of your random variable is.

Related

Most frequent value in dataset (with variation) [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
This is a part programming, part statistical math question.
I have a dataset where I want to get the most frequent number (mode), the problem is that I am dealing with values with slight variation.
So normally {1,2,50,50,90} the most frequent number would be 50
But in my case the numbers look like this:
{1,2,49,50,51,90} but the result is still 50
So my question is how can I efficiently calculate this number and is there a statistical term for this number?
Some pseudo code:
Float items.val[] = {1,2,49,50,51,90};
Float threshold = 4;
For (item in items) {
For (subitem in items){
Float dist=Distance(time,subitem)
If (dist < threshold){
item.dist += dist
}
}
}
Output=Sort(item.dist)[0]
There are various ways to go about this.
(1) the most careful, exact way is to assume a probabilistic model for the observed values, and look for the mode (as the expected value or most probable or some other criterion) of the inferred values. I am going to guess this is far too much work in this case, although given unlimited time I would certainly want to approach it that way.
(2) construct a histogram, and look for the bin which has the greatest density (with density = (#items in bin)/(width of bin)). This doesn't necessarily yield a single value.
(3) fit a parametric distribution to the observed values, and report the mode of the fitted distribution.
You might get more traction for this question at stats.stackexchange.com. Good luck and have fun.
EDIT: After looking at your example code, I see it is not too different from (2) above. It seems like a reasonable and workable approach.

Is there any further steps to calculate phase after dft? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I am trying to find magnitude and phase of fourier transform. There is an tutorial Opencv.
After using this formula, we are going to switch to a logarithmic scale and shifting normalizing. But I could not find for phase. Phase formule is :
Here is the question after arctan calculation, do I need to do extra stuff like magnitude(log scale,shifting,normalizing)? Or what is the logic behind it I could not understand? I am programmer guy and I am very far from these Math stuff.
The arctan range is (−π, π]. Hint: use std::atan2. You may indeed shift this to [0, 2*π) if you like. This is in no way necessary, it just avoids negative numbers.
Scaling to 360 degrees is also possible, but very rare - math is always done in radians, degrees are only for human consumption, and which human is going to look at FFT magnitudes?
Log scales are utterly pointless for angles, as they are modulo 2π.

Calculating a coordinate from 2 given 1-dimensional lines [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
What is the and optimal method, if not the best, for doing it?
Assume that I have an object that has 2 wheels. The only information I have available is how far the wheels have rolled at any time.
Basically, I want to know how to calculate the coordinates (x2,y2)
I put this question on the programming section because I want to solve this with an algorithm or plainly put, by programming (in c++).
Given that you have how far the wheels have rolled at any time, it means that you have two functions of time w1(t) w2(t) giving the distance covered by the wheels.
from that you may by derivation get the scalar velocity of each wheel as v1(t) and v2(t).
As your object position is the mean between the position of those two wheels, the velocity of your object is the mean of those two velocities, but the difference of the velocities gives the speed of rotation of the object. So you have essentially a velocity described as a scalar velocity plus a rotation speed.
By integrating that vectorial quantity you may arrive to the current position of your object.
Details must be thought carefully, but the idea I think is that.

C++ comparing two value to find which is closest to user input value [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have been looking on the internets for a while to find a solution to my problem. First some back ground. I'm writing a program that calculates catapult trajectory. The user must first type in a distance. Then I loop through the combinations of angle degrees and velocity to find which combination will give a distance that will come the closest to the users input. I don't quite know how to do the variable comparison to find which combination of degrees and velocity produces a distance closest to a users input of distance. I'm just trying to keep it simple and easy as possible. Also, I'm not using any kind of array to store the values. I want it done on the fly inside my for loops if possible. Any suggestions?
Well, the answer to this depends on the complexity of your trajectory formula. I'm guessing that you're not taking fluid dynamics or gravity differentials into consideration. In fact, what I imagine is that you're using a basic parabolic equation...
That equation can be solved directly by rearranging. But the thing is, you're solving for two variables that are actually co-dependent. There are infinite solutions if you allow both angle and velocity to vary, so you need to restrict the 'best' answer by some criteria (for example, desired angle or desired velocity).
If you have more variables, like lift, drag, spin, incident shape, non-constant gravity, air pressure and humidity, then you will need to employ a minimization algorithm which is non-trivial. One of the most basic, but a little unstable, is the Nelder-Mead algorithm.
If this has not been helpful enough, you should provide more information about your problem, and show some code.

Suggestions for alternative 3D space partition tessellation, different from Voronoi and Delaunay [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
I have a system of mono-disperse spheres inside a cubic box. I am studying the volume distribution inside the sample, after tessellating it with either Voronoi and Delaunay tessellations. I am interested on some properties which should not depend on the tessellation.
Currently, I am comparing with the values obtained from Voronoi and Delaunay. I would like to know if you are familiar with another space partition approach (It is important that the final sum of the individual cells add up to the total volume, and the cells should be disjoint). Furthermore, in case you know another kind of tessellation, do you also know a library which already implements it, preferable in C/C++ or python?
Some variations, like Laguerre partitions, coincide with my current Voronoi approach since the spheres are mono-disperse. Another candidate will be the Centroidal Voronoi tessellation, although I have not found yet a library to do that (although it could lead to evenly spaced cells which does not reflect the disorder inside the system, which is not desirable).
Thanks in advance for your kind help.