how to obtain the gray level values of the image pixels??
Show older comments
I'm doing handwriting analysis,for that one feature is to identify the pressure.For the analysis of pen pressure, Mean gray level value is computed using the gray level values of the image pixels.But how to take these gray level values?? For reference i have attached the image.Please do help me.Thank you
if i use
meanIntensityValue = mean(grayImage(:));
is it that mean of both white and black pixels ? i want only mean of black pixels.

Answers (1)
Image Analyst
on 19 Dec 2015
You can get a mask of the letters using my attached demo.
Then do
meanGrayLevel = grayImage(mask);
9 Comments
Image Analyst
on 19 Dec 2015
You might also need to consider the width of the pen line. It might be narrower when the pressure is lighter.
Meghashree G
on 20 Dec 2015
Meghashree G
on 20 Dec 2015
Image Analyst
on 20 Dec 2015
bwdist() can give that.
Walter Roberson
on 20 Dec 2015
imgradient is in the image processing toolbox since R2012b. Either you have an earlier MATLAB or you do not have that toolbox installed (or licensed.)
Meghashree G
on 20 Dec 2015
Meghashree G
on 22 Dec 2015
Image Analyst
on 22 Dec 2015
mask in that line of code is called binaryImage in the document_threshold.m file.
You can put the line of code to compute the mean gray level wherever you need it, perhaps right after you compute the binary image mask.
Meghashree G
on 8 Jan 2016
Categories
Find more on Convert Image Type in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!