Re: How to calculate contrast in different parts of an image in Matlab?



Predictor wrote:
I don't know whether there exists a conventional mathematical
definition of "contrast", but I would think that any decent measure of
dispersion (image in X: var(X(:)) or std(X(:)) in MATLAB base or
iqr(X(:)) in the Statistics Toolbox) might serve as a reasonable
measure of contrast.


Do I read his right? Is it that the modern defintiion of contrast is now the standard deviaton (or alteratively, variation) of the optical-electronic video signal? In days gone by, that metric would be called "contrast ratio", I believe, and would be the ratio of the maximum to the minimum brightness (inthe real world); while the electrical signal would be well, whatever it is; whether the image sensor transfer function (delta voltage per delta brightnes) is linear, or square law, or square root, or some other power.


I have intermediate knowledge about Matlab , but very basic about the
image processing tooolbox and I have a project due in a couple of
weeks. I have to find out 7 to 10 points of high contrast in a colored
I don't have much clue as to how to approach this thing because I dont
know how to calculate contrast of a region. I read about the image
processing toolbox but couldn't find much help.

Most (all?) digital codes are devoid of any physical reality. They are all "virtual" and no "reality". You as the daddy of system under development, have to do all the physics and the elementary math, then weave those into an operational code; your creation.

In my opinion, you go out and get those 7 to 10 points by honest physics methods, plot the curve, estimate the power of the curve that matches it, then coin that in matlab as Y=X^n, where n is determined as avove. You also need to get the feel of the maximum and brightness the electrooptical chain can tolerate consistently, and the minimum brightness (essentially the opto-electronic "noise floor").

>>( I was thinking of taking a window size of say 23x23 pixels, and
calculate local contrast all over the image, and then sort out my
results in descending order and choose the first 10 values and its
corresponding pixel location...but how to calculate contrast?)

It may be amatter of semantics. What do "THEY" mean by "Contrast" in your system? They might mean contrast limits (the greatest and the least brightness wanted to be processed without saturation; no delta Y for any more delta X). (The operative word is "wanted"; it may not be neccessary or even desirable, to process glinting highlihts, or depicting shadow detail beyond certain limits, which you as the daddy get to declare.)

The monotonic functons described so far, have more to do with the old photographic concept of "gamma". The math fuctions (variance, stadard deviaion) are really another measure of max/min or 'constrast ratio'. Thus, avariance of 10 units, when the scenery videa was a pure sine wave, would be a contrast ratio of 10*2*sqrt(2), or 28.3.

Angelo Campanella

.



Relevant Pages

  • Re: real plasma "contrast ratio" ??
    ... does...I see many around Contrast at 3000:1 and Brightness at 1500 ... Viewing angle: Forget what the manufacturer claims and just walk back ...
    (alt.tv.tech.hdtv)
  • Postcscript: Hi-tech Accessibility Catch-22
    ... >> and contrast for you. ... > brightness from the '80' default, ... Having used the Samsung flat panel for a week now, ... over its advantages vs. the flat CRT monitor I used before. ...
    (uk.people.disability)
  • What Are the Important Display Specs?
    ... Starting with Brightness: Plasmas are listed as being considerably ... Contrast ratio: My computer monitor is listed at about 800:1 while ... My TV set advertises 178 degrees viewing angle. ...
    (alt.tv.tech.hdtv)
  • Re: HDV to HD-DVD
    ... If the preview is adequate for contrast and brightness adjustment, ... HC3?) ... preview it in HDV is either to add a Blackmagic Decklink or AJA card ...
    (rec.video.desktop)
  • Re: Algorithm for "Windows Center" and "Windows Width"
    ... or how to find new w/l value from the y. ... c is window center and w is window width: ... calculate W/l and apply to the contrast and brightness?. ...
    (comp.protocols.dicom)