paul_hutson Posted January 17, 2003 Share Posted January 17, 2003 I am trying to determine the "redness" of a person's palm and sole by evaluating digital images using L*a*b values. Is there a way in Photoshop or another program to average the L*a*b values over a selected area (eg., entire palm) rather than just a 3 pixel area (dropper)? Thanks Paul UW School of Pharmacy Link to comment Share on other sites More sharing options...
andy_piper2 Posted January 17, 2003 Share Posted January 17, 2003 Well, one way would be to reduce the image resolution drastically (on a COPY of the image file!) so that the palm or sole is reduced to a single pixel (or a 3x3 array). In resampling the image Photoshop will come up with an 'average' value from all the previous pixels, which you can then measure with the eyedropper. Actually you'd probably want the final pixel to be just slightly smaller than the sole/palm, to avoid picking up any color or brightness values, in the 'average', from the surrounding background. There's also a 'pixellate' filter that will do roughly the same thing (but creating bigger squares instead of reducing the image file size). In either case you'll have to experiment a bit (with liberal use of the "undo" command) to find settings for image size or pixel size that work best for the image you're starting with. Link to comment Share on other sites More sharing options...
emre Posted January 17, 2003 Share Posted January 17, 2003 Select the region and apply a strong Gaussian blur. Link to comment Share on other sites More sharing options...
jim schwaiger Posted January 17, 2003 Share Posted January 17, 2003 The eyedropper has the ability to average to some degree. Link to comment Share on other sites More sharing options...
andy_piper2 Posted January 18, 2003 Share Posted January 18, 2003 I just tested Emre's suggested technique - but while the "strong gaussian blur" only CHANGES the pixels within the selected area, it does pick up tones/colors from outside the selected area (but within the blur radius) as part of the blurred tone, which could throw off color measurements. See example<div></div> Link to comment Share on other sites More sharing options...
andy_piper2 Posted January 18, 2003 Share Posted January 18, 2003 Example shows the back of a hand, not the palm, but the principle applies. I used the 'pixellate/mosaic' filter over that part of the image - each 'pseudopixel' or 'superpixel' created averages the tones within it. You can vary the size of the superpixels when applying the filter to get the best fit to your image. A 10x10 array will average 1000 pixels into 10, cutting the number of measurements you need to make by a factor of 100. Photoshop will do at least 95% of the work for you. As with Emre's technique the pixels near the edge pick up some contamination from colors/tones outside the hand - so assume they are 'bad data'. Link to comment Share on other sites More sharing options...
emre Posted January 19, 2003 Share Posted January 19, 2003 Andy is certainly on the ball, but I am not going to be trumped by him :P <p> I tested my method too and he is right. I have good news and I have bad news. The good news is that I found a way to avoid the problem. The bad news is that the selection has to be rectangular unless you use a supporting application. Make your selection using the "rectangular marquee" tool. Copy it and paste it into a new document. Apply Gaussian blur with maximum radius. This time fringing won't occur because there is no fringe :) <p> There is a better way if you have MATLAB. Save your selection (ensuring the rest is transparent) as a PNG or TIFF into a separate file and run the following commands in MATLAB: <p><hr> <code> img=imread('selection.png');<br> vec=reshape(img,prod(size(img))/3,3);<br> ind=find(sum(vec,2));<br> average(vec(ind,:));<br> </code><hr> N.B.: You might need to change directory first with CD. <p> What we do here is to convert the image matrix into a vector. Then we discard the background (zeros in the matrix) and find the average of what is left. The 'average' function does not exist -- you have to define it to implement your definition of "average". Link to comment Share on other sites More sharing options...
paul_hutson Posted January 20, 2003 Author Share Posted January 20, 2003 Andy and Emre, you two are amazing. Thanks very much for your excellent ideas. I think that, with no MATLAB experience, I will try the Photoshop export/Gaussian blur that Emre suggests. The MATLAB online manual suggests that the vector used is RGB, which raises another issue (posted as a new thread) about the "best" measure of redness, and whether one scale is better than another (eg., linear) for making statistical comparisons of "redness". Thank you very much.Paul Link to comment Share on other sites More sharing options...
emre Posted January 20, 2003 Share Posted January 20, 2003 Perhaps I should have touched upon that. You can convert between RGB and HSV by using <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/rgb2hsv.shtml"><code>rgb2hsv</code></a> and <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/hsv2rgb.shtml"><code>hsv2rgb</code></a>. A similar conversion is possible between <a href="http://www.tsi.enst.fr/tsi/enseignement/ressources/mti/correl_couleur/sourcematlab.html#RGB2LAB">RGB and Lab</a>. Now you can take your pick. Obviously you still need to define a metric! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now