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:
contrast

Subject: contrast

From: Jessica

Date: 3 May, 2014 15:46:09

Message: 1 of 9

Does anyone have any suggestions for calculating contrast within an image? For example, I have a digital image of a face. I want to calculate the contrast between the two eyes compared with the rest of the face. I have a list of coordinates that maps out a polygon of the entire face as well as a list of coordinates that outlines each of the eyes.

Subject: contrast

From: Valeriy

Date: 3 May, 2014 20:40:13

Message: 2 of 9

If I will have such task, I will construct two masks. Mask is matrix with sizes of your image. Area of interests (eyes or face) are filled by 1, other space is filled by 0. Than you have to multiply mask of eyes on image matrix and calculate, for example, "eyes" average, minimal, maximal values. In the same way you can calculate average of other "face" values and you can make any kind of comparison between these values.
Good luck

Subject: contrast

From: Jessica

Date: 4 May, 2014 13:52:10

Message: 3 of 9

Thanks for this suggestion. How would you suggest I create a mask using the polygon coordinates of the areas of interest (i.e., eyes and face)? Then, how would I calculate the contrast values given the masks?

"Valeriy" wrote in message <lk3k7d$2k4$1@newscl01ah.mathworks.com>...
> If I will have such task, I will construct two masks. Mask is matrix with sizes of your image. Area of interests (eyes or face) are filled by 1, other space is filled by 0. Than you have to multiply mask of eyes on image matrix and calculate, for example, "eyes" average, minimal, maximal values. In the same way you can calculate average of other "face" values and you can make any kind of comparison between these values.
> Good luck

Subject: contrast

From: Valeriy

Date: 7 May, 2014 15:15:10

Message: 4 of 9

"Jessica " <jly5@duke.edu> wrote in message <lk5gma$gpg$1@newscl01ah.mathworks.com>...
> Thanks for this suggestion. How would you suggest I create a mask using the polygon coordinates of the areas of interest (i.e., eyes and face)? Then, how would I calculate the contrast values given the masks?
It depends from what do you mean "contrast"? What kind of image treatment you need? In general contrast of some area can be calculated as (Imax - Imin)/(Imax + Imin), where Imax and Imin are corresponding values of image intensity. Perhaps for your particular case it can be determined as Iaverage("eyes")/Iaverage("face") or by any other kinds, it depends of treatment idea.

Subject: contrast

From: Jessica

Date: 7 May, 2014 16:48:09

Message: 5 of 9

Yes, I think calculating the mean pixel intensities of the eyes and of the face would be the way to go. Do yo have suggestions for how I go about doing that?

"Valeriy" wrote in message <lkdilu$sb4$1@newscl01ah.mathworks.com>...
> "Jessica " <jly5@duke.edu> wrote in message <lk5gma$gpg$1@newscl01ah.mathworks.com>...
> > Thanks for this suggestion. How would you suggest I create a mask using the polygon coordinates of the areas of interest (i.e., eyes and face)? Then, how would I calculate the contrast values given the masks?
> It depends from what do you mean "contrast"? What kind of image treatment you need? In general contrast of some area can be calculated as (Imax - Imin)/(Imax + Imin), where Imax and Imin are corresponding values of image intensity. Perhaps for your particular case it can be determined as Iaverage("eyes")/Iaverage("face") or by any other kinds, it depends of treatment idea.

Subject: contrast

From: Valeriy

Date: 11 May, 2014 08:55:07

Message: 6 of 9

"Jessica " <jly5@duke.edu> wrote in message <lkdo48$ee5$1@newscl01ah.mathworks.com>...
> Yes, I think calculating the mean pixel intensities of the eyes and of the face would be the way to go. Do yo have suggestions for how I go about doing that?

This is very simple:
MeanEyes = mean(mean(EyesMask.*YourImage))
or you can try exchange "mean" by "median", it depends from your preferences and image characteristics.

Subject: contrast

From: perfectpopular1@gmail.com

Date: 17 May, 2014 15:59:26

Message: 7 of 9


web is: www.perfectpopular.com ,they offer all kinds of grade AAA product,such as

shoes,handbag,clothes, here with wholesale price! Our shoes have some advantages as

following: 1) Grade AAA shoes! 2) The wholesale price! 3)100% safe, the best delivery

terms! 4) No mini order here! 5) The best service!

Subject: contrast

From: Jessica

Date: 21 May, 2014 14:53:12

Message: 8 of 9

Do you mind describing how to create the mask from the image?

"Valeriy" wrote in message <lkndtb$hb3$1@newscl01ah.mathworks.com>...
> "Jessica " <jly5@duke.edu> wrote in message <lkdo48$ee5$1@newscl01ah.mathworks.com>...
> > Yes, I think calculating the mean pixel intensities of the eyes and of the face would be the way to go. Do yo have suggestions for how I go about doing that?
>
> This is very simple:
> MeanEyes = mean(mean(EyesMask.*YourImage))
> or you can try exchange "mean" by "median", it depends from your preferences and image characteristics.

Subject: contrast

From: Valeriy

Date: 3 Jun, 2014 03:50:09

Message: 9 of 9

"Jessica " <jly5@duke.edu> wrote in message <llieko$nsb$1@newscl01ah.mathworks.com>...
> Do you mind describing how to create the mask from the image?
Non, this is way how to calculate mean or median value of your area of interest.

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