variance of the vertical projection

hello I need a code to calculate the variance of the vertical projection of an image please help me

Answers (2)

vertproject = any(grayimage);
vertprojectvar = var(vertproject);
I don't see any value in this. Perhaps you mean something different by "vertical projection" than what is usually meant here.

5 Comments

I often use projections when you want to find things in an image, like grid lines (say, in the Color Checker chart), or find edges of your ROI (say your sample is in some kind of frame or mounting bracket and you need to locate exactly where your sample lies).
Walter Roberson
Walter Roberson on 14 Jan 2013
Edited: Walter Roberson on 14 Jan 2013
Right, but I can't think of any value in var() of this projection.
Actually I have used that to determine how "splotchy" a scene is. I take horizontal and vertical projections and then look at the standard deviation of the profile. A perfectly uniform image would give 0 (flat profile) and the more splotchy the image is, the higher the standard deviation will be. You can't get that from just a histogram. There are other measures of splotchiness that are also used, like the mean of an edge filtered version of the image (say a DOG filter) - things like that.
However variance is not sensitive to order, so how can you tell the difference between (say) solid-black left-half with solid-white right-half, compared to the much more "splotchy" near randomization of the order of the same columns ?
True. One measurement is not enough to tell the story and be robust enough for all possible image appearances so we need multiple measurements. Another measurement that is made is to fit the profile to linear and quadratic curves and look at the mean absolute difference and the RMS difference between the fit and the actual profile.

Sign in to comment.

Try this:
verticalProjection = sum(grayImage, 1); % Could use mean also.
theVariance = var(verticalProjection);
If that's not what you mean, then explain better.

Asked:

on 14 Jan 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!