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:
How to know at which level histogram has equal pixels?

Subject: How to know at which level histogram has equal pixels?

From: Learner

Date: 3 Jan, 2012 13:11:08

Message: 1 of 3

hello,

actually i want to know at which gray-level the histogram pixels divides into equal or approx equal to parts?

i.e. let suppose we have 10x10, 8-level image.
so the no. of pixels in the histogram will be 100.
Now to divide the total no. of pixels to half i.e. 100/2 = 50.

Now how we can know that: to which level in histogram we have equal no. of pixels on both the sides? i.e. 50 & 50.

^^ HOW CAN I DO THIS? actually i am more concern for higher dimension images.

PLEASE HELP ME OUT.

Subject: How to know at which level histogram has equal pixels?

From: Jeff

Date: 4 Jan, 2012 19:50:08

Message: 2 of 3

"Learner" wrote in message <jduupc$3fh$1@newscl01ah.mathworks.com>...
> hello,
>
> actually i want to know at which gray-level the histogram pixels divides into equal or approx equal to parts?
>
> i.e. let suppose we have 10x10, 8-level image.
> so the no. of pixels in the histogram will be 100.
> Now to divide the total no. of pixels to half i.e. 100/2 = 50.
>
> Now how we can know that: to which level in histogram we have equal no. of pixels on both the sides? i.e. 50 & 50.
>
> ^^ HOW CAN I DO THIS? actually i am more concern for higher dimension images.
>
> PLEASE HELP ME OUT.

The functions HISTC and CUMSUM should get you what you need. I suspect there is a more elegant way to do this, but it is escaping me at the moment.

Subject: How to know at which level histogram has equal pixels?

From: Matt J

Date: 4 Jan, 2012 20:02:09

Message: 3 of 3

"Learner" wrote in message <jduupc$3fh$1@newscl01ah.mathworks.com>...
>
> Now how we can know that: to which level in histogram we have equal no. of pixels on both the sides? i.e. 50 & 50.
==================


median(YourImage(:)); %Works for image arrays of any dimension

Tags for 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