Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
image normalization

Subject: image normalization

From: Vinod

Date: 4 Mar, 2010 10:37:23

Message: 1 of 6

Hello Friends,

What is normalization(for image and a signal)?
What I understand is for eg a signal x = [1 3 5 7 9 11].

1) Is it norm_x = x/sum(x) or norm_x = x/sum(|x|). If it is abs values of x, why is it so?

2) In case of images how do I approach this task? Should I first take the normalization of rows and then follow it with that of columns? Or would normalization of rows serve my purpose? Is it then necessary to move into column processing? Would it involve dividing of each pixel by the sum of the row(relevant0 or by the whole image sum?

3) What is the need/use and application of normalization. What data can I get from image normalization?

Regards,
Vinod Karuvat.

Subject: image normalization

From: ImageAnalyst

Date: 4 Mar, 2010 12:42:54

Message: 2 of 6

Vinod Karuvat:
Normalization can be defined in several ways, including one you didn't
mention: signal / (the max value of the signal). Which definition you
use really depends on what you want to do. You don't just arbitrarily
normalize using one of the formulas chosen at random -- you have to
have in mind something that you want to accomplish. What do you want
to accomplish?

Subject: image normalization

From: Vinod

Date: 5 Mar, 2010 05:49:06

Message: 3 of 6

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <03a6d8b8-1e96-4521-89e5-73cc35f4cc56@d2g2000yqa.googlegroups.com>...
> Vinod Karuvat:
> Normalization can be defined in several ways, including one you didn't
> mention: signal / (the max value of the signal). Which definition you
> use really depends on what you want to do. You don't just arbitrarily
> normalize using one of the formulas chosen at random -- you have to
> have in mind something that you want to accomplish. What do you want
> to accomplish?

Hello Sir,
As of now I do not want to accomplish any particular thing. what I wanted to know is that what all can I accomplish using normalization. What are the applications where-in normalization can be made use of and so on and so forth. Could you please shed some light on that?

Regards,
Vinod

Subject: image normalization

From: Tim

Date: 5 Mar, 2010 06:24:06

Message: 4 of 6

In general, normalisation of a signal like image or audio is simply to have the signal stretch from the minimum to the maximum. As mentioned, though, there are other uses of the word, so you have to be careful. However, neither of yur formula seem to hit that definition, no matter how I twist it, so I'm not sure if that is really what you are after.

Is we are talking about normalising a signal in the way mentioned above, then the first job is to get he signal into the range [0, 1], and then life becomes easy. So, in you case, and step by step (this can be reduced to a single line):

1) x2 = x-min(x) % Now you have the range [0, max-min]
2) x3 = x2/(max(x)-min(x)) % Now you have [0, 1].
3) x4 = x3*(newMax - newMin)
4) x5 = x4 + newMin
5) We are done!

Note that often this simplifies dramatically; for example, in audio, we only modify the maximum, so it is one multiplication and we are done. Often we don't care about the lowest form of the signal, merely the maximum. Also, usually our new range begins at 0, so step 3 becomes x3*newMax, and we are done.

So why do all this? Well, one reason may be because whatever we are outputting to expects a signal in a particular form. If you exceed 255 and are going into an 8bit device, your signal will be "clipped" (if you are lucky) and this is bad.

Another reason may just be to "see" the signal better. The difference between two grey levels that vary by one is trivial. This is one way of "stretching" the signal out, in a lossless fashion.

Finally, data may be more comparable if both sets are normalized first.

P.S Please forgive changing between normalise and normalize. I'm an Aussie on a US spell checker.

P.P.S All of this may be completely up the wrong tree for you. In which case, sorry for cluttering up your replies!


"Vinod " <vinodkaruvat@gmail.com> wrote in message <hmo2h3$a94$1@fred.mathworks.com>...
> Hello Friends,
>
> What is normalization(for image and a signal)?
> What I understand is for eg a signal x = [1 3 5 7 9 11].
>
> 1) Is it norm_x = x/sum(x) or norm_x = x/sum(|x|). If it is abs values of x, why is it so?
>
> 2) In case of images how do I approach this task? Should I first take the normalization of rows and then follow it with that of columns? Or would normalization of rows serve my purpose? Is it then necessary to move into column processing? Would it involve dividing of each pixel by the sum of the row(relevant0 or by the whole image sum?
>
> 3) What is the need/use and application of normalization. What data can I get from image normalization?
>
> Regards,
> Vinod Karuvat.

Subject: image normalization

From: Vinod

Date: 5 Mar, 2010 06:43:21

Message: 5 of 6

"Tim " <tim.bate@gmail.com> wrote in message <hmq826$fc4$1@fred.mathworks.com>...
> In general, normalisation of a signal like image or audio is simply to have the signal stretch from the minimum to the maximum. As mentioned, though, there are other uses of the word, so you have to be careful. However, neither of yur formula seem to hit that definition, no matter how I twist it, so I'm not sure if that is really what you are after.
>
> Is we are talking about normalising a signal in the way mentioned above, then the first job is to get he signal into the range [0, 1], and then life becomes easy. So, in you case, and step by step (this can be reduced to a single line):
>
> 1) x2 = x-min(x) % Now you have the range [0, max-min]
> 2) x3 = x2/(max(x)-min(x)) % Now you have [0, 1].
> 3) x4 = x3*(newMax - newMin)
> 4) x5 = x4 + newMin
> 5) We are done!
>
> Note that often this simplifies dramatically; for example, in audio, we only modify the maximum, so it is one multiplication and we are done. Often we don't care about the lowest form of the signal, merely the maximum. Also, usually our new range begins at 0, so step 3 becomes x3*newMax, and we are done.
>
> So why do all this? Well, one reason may be because whatever we are outputting to expects a signal in a particular form. If you exceed 255 and are going into an 8bit device, your signal will be "clipped" (if you are lucky) and this is bad.
>
> Another reason may just be to "see" the signal better. The difference between two grey levels that vary by one is trivial. This is one way of "stretching" the signal out, in a lossless fashion.
>
> Finally, data may be more comparable if both sets are normalized first.
>
> P.S Please forgive changing between normalise and normalize. I'm an Aussie on a US spell checker.
>
> P.P.S All of this may be completely up the wrong tree for you. In which case, sorry for cluttering up your replies!
>
>
> "Vinod " <vinodkaruvat@gmail.com> wrote in message <hmo2h3$a94$1@fred.mathworks.com>...
> > Hello Friends,
> >
> > What is normalization(for image and a signal)?
> > What I understand is for eg a signal x = [1 3 5 7 9 11].
> >
> > 1) Is it norm_x = x/sum(x) or norm_x = x/sum(|x|). If it is abs values of x, why is it so?
> >
> > 2) In case of images how do I approach this task? Should I first take the normalization of rows and then follow it with that of columns? Or would normalization of rows serve my purpose? Is it then necessary to move into column processing? Would it involve dividing of each pixel by the sum of the row(relevant0 or by the whole image sum?
> >
> > 3) What is the need/use and application of normalization. What data can I get from image normalization?
> >
> > Regards,
> > Vinod Karuvat.

Hello Sir,

Thank u very much for your reply. It was very informative. How can this be applied to a 2D image?
How can normalization be made use of in the 2D domain? For example if I want to compute the probability density function I would need to first normalize the matrix/image and so on and so forth.
Likewise could you specify the other applications of normalization. Also could you please paste some links of normalization(I am looking for the math and also examples) please.

Again thank you very much.
Regards,
Vinod.

Subject: image normalization

From: Tim

Date: 5 Mar, 2010 07:11:31

Message: 6 of 6

> Hello Sir,
>
> Thank u very much for your reply. It was very informative. How can this be applied to a 2D image?
> How can normalization be made use of in the 2D domain? For example if I want to compute the probability density function I would need to first normalize the matrix/image and so on and so forth.
> Likewise could you specify the other applications of normalization. Also could you please paste some links of normalization(I am looking for the math and also examples) please.
>
> Again thank you very much.
> Regards,
> Vinod.

Ah! Probability density function! And NOW I see how your formula might relate. If you want to normalise a histogram, then you might divide the frequency of an occurence by the sum of the frequencies of the occurences! And this is basically a probability distribution!

Ok, so if we are talking about normalising a HISTOGRAM, here is what you do. You have a 2D image, lets say in 8 bit grey scale for now. That means values from 0 to 255, or 256 possible values. One thing we can do is generate a histogram. Ignoring bins for now, this means we turn our data into a graph of grey lvl vs. number of occurances of that grey level. So, we have a 256 elelment matrix. The first element will store the number of 0s in the image. The second the number of 1s and so on, until the 256th element stores the number of 255s. Matlab can do this for you automatically, or you can do it. The algorithm is simple.

What you have in now is a histogram with values ranging from 0 upwards. The largest value you can have is equal to the resolution of the image - you can't have more pixels of a single level than every pixel in the image. To NORMALISE, we then go through and divide each of our matrix values by the total number of pixels in the image. NOW our histogram has values from 0 to 1. So this is really like steps 1 and 2 from my earlier post, but applied to frequencies.

So, if we want the maths? Well, lets say X holds all the frequencies (NOT the image itself.) X is a histogram already, but not normalised. Then the MAXIMUM value X can have is equal to ALL the pixels in the image. Which is also equal to the SUM of all the frequencies in X. So, we end up with a normalised histogram equal to X/sum(X) - just like you posted earlier! Also, all of our values MUST be positive, so you can take absolutes until the cows come home, the result won't change.

The result is a normalised histogram, where each index is a value from 0 to 1, equal to the proportion of pixels in the image that have that grey level. Another way of saying this is that if you chose a pixel at random from the image, the probability of it having grey level i is = X(i). Another way of saying THAT is that X is nor the probability density of the grey levels in the image!

Lets assume thouh that you actually DID want to normalise the grey level image itseld. This is normalising LEVELS and not the HISTOGRAM, so you probably don't need this. Lets assumel the image is stored in I (probably as a two dimensional array, whereas X was a one dimensional array (histogram)). LEts assume our image is 8 bit greyscale again. Then two stretch this (same as auto levels in photoshop), we want to get it to the origin:
I-min(I)
We want to stretch it to 255 (our max) and to do this it all becomes:
( 255*(I-min(I) ) / ( max(I)-min(I) )
In other words, pull the minimum down to 0, divide by your new range (so max is 1) and multiply by your new max. This only works if you want a new minimum of 0 - which is pretty common.

It should be noted that doing any of this with colour becomes trickier, PARTICULARLY for levels. This is why we have L*A*B*.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us