Measuring whole image CMYK

FB
Posted By
Fulvio_Baiarda
Oct 16, 2006
Views
567
Replies
17
Status
Closed
Hi,

I’m hoping there’s an easy answer to this, although an hour’s searching hasn’t turned it up so far!

I’m doing research which involves image analysis. Part of this involves staining slides of muscles in a certain way which shows up certain muscle fibres as black and others as cyan. In order to measure what proportion of fibres are stained black or cyan, I now need a way of measuring the total amount of cyan and black in the entire image. I was hoping I could do this using Photoshop CS just by using the Histogram Info panel to measure CMYK. However it seems that you can’t measure whole image CMYK, just individual regions of image.

So my question is, does anybody know a way of measuring the average CMYK profile of an entire picture? Failing that can someone with better image processing skills than me think of an alternative way of doing this?!

Thanks and best wishes,

Fulvio

Must-have mockup pack for every graphic designer 🔥🔥🔥

Easy-to-use drag-n-drop Photoshop scene creator with more than 2800 items.

CS
Carl_Stawicki
Oct 16, 2006
However it seems that you can’t measure whole image CMYK, just individual regions of image.

I’m not sure what that means, but if you don’t have a selection, then the histogram is of the entire image.

But to answer your question, the Mean of the histogram is what you need to look at. If you want a percentage, then you’ll need to do some math to convert the level to a %.
CB
charles badland
Oct 16, 2006
NIH offers free image analysis software that may do a better job: <http://rsb.info.nih.gov/ij/>

But, if you want try in Photoshop- I’d use the Select>Color Range feature for the two colors. then compare the number of "cyan" selected pixels to the number of "black" selected pixels in the expanded Histogram palette.
You would have to select each color at a time, and adjust the “fuzziness”. Not a very scientific method.
FB
Fulvio_Baiarda
Oct 16, 2006
Hi Carl,

Thanks for your message – the mean of the histogram sounds just what I need. How do I get that?! I know that if you don’t have a selection then the histogram is of the entire image, but I need numeric values for CMYK (or RGB for that matter) and it seems that this average is pretty hard to obtain – even without a selection, or with the entire image selected, the CMYK values vary according to where you point your cursor.

Fulvio
FB
Fulvio_Baiarda
Oct 16, 2006
Hi Charles,

Thanks for the link – in fact I use ImageJ quite a lot, and there is a plugin (RGB measure) which seems to do almost what I’m after. I’d prefer to use Photoshop as ImageJ is pretty buggy, but failing that I think I will do as you suggest.

Thanks again,

Fulvio
CS
Carl_Stawicki
Oct 16, 2006
Look to the histogram palette for the Mean. Make sure the statistics are showing. Also note that this number will only be accurate if the cyan and black are perfectly separated into thier respective channels. If by cyan you mean "cyan-looking," then it’s a different story, and you’ll be better off with Charles’ Color Range solution.
P
PeterK.
Oct 16, 2006
It sounds like the function Filter-Blur-Average will give you what you need. It averages all of the values in the image and gives you a solid patch representing the average value you would get if you mixed all the pixels together in the proportions that they are in.
ex. if a quarter of the image is 100% black and three quarters of the image is 100% cyan, the average colour of that image would be 25%K, 75%C.
CB
charles badland
Oct 16, 2006
You’ll seldom find a photograph where the "blacks" are 0C, 0M, 0Y, 100K.
CS
Carl_Stawicki
Oct 16, 2006
I was thinking the Average filter could be used also for this, as long as the image was strictly cyan and black.
P
PeterK.
Oct 16, 2006
Yes, if you have actual cyan in the black areas (as in the rich black of a photo), then that will give you a bad result. You would first have to get rid of the cyan in those black areas to give you a real average.
Fulvio, how are you getting this cmyk image? Is it an actual photograph? Or are you taking info from one scan (as in greyscale info) and putting it into a cyan channel, then info from a second scan and putting it into the black channel, or is it simply a CMYK scan, or RGB scan converted to CMYK?
FB
Fulvio_Baiarda
Oct 17, 2006
Guys, this is the first time I’ve posted here and I have to say you’ve all been brilliant, so thanks very much!

PeterK, I think that is exactly the solution I was looking for! Brilliant!

In response to the other comments:

Absolutely right, the image isn’t ‘pure’ – the cyans aren’t pure cyan and the blacks aren’t pure black. However I have spent yesterday afternoon taking multiple control readings of examples of my ‘cyan’, ‘black’ and ‘white’ areas, and the RGB (I switched to RGB because this is what the alternative package, ImageJ, supports) profiles of each are characteristic – both in terms of range and relative proportion. I am now working through the mathematics of deriving relative proportions from an average RGB reading, and early on this is looking like a very promising approach. I have created test images of both 1:1 and 1:2 black:cyan areas, and the formula elicits these accurately. I now need to do some testing on real images, but I am quite excited by this – as far as I can tell this is a new method, and once I’ve written a spreadsheet for it and perhaps a Photoshop Action, this should be very quick!

The images are actual photographs – taken from a microscope-mounted digital camera as tiff’s. The final thing I think I need to think about (unless anyone can correct me) is standardisation of light intensity, exposure etc, although as you might imagine this is considerably easier in the laboratory setting than in the real world and shouldn’t be a big problem.

Thanks again,

Fulvio
E
eltee
Oct 17, 2006
what’s the goal?

keep track of high, medium and low key pictures : )
P
PeterK.
Oct 17, 2006
I should warn again that if you just convert to CMYK you’ll get CMY in your blacks, and the C under the blacks will skew the results of the Cyan you’re trying to measure. One conceivable way I can think of to remove the colours underneath black would be to go into the CMYK settings and make a custom setting with GCR, Maximum black generation, 100% ink limit. Then when you convert from RGB to CMYK, *most* of the CMY colour will be gone. In areas where black is the darkest possible, you’ll get 100% black with none of the other colours. In areas where black is not it’s darkest you will still get some of the other colours, however, the CMY will be greatly reduced. It may be that those "grey" areas need to show some of the cyan in them, if there actually is some cyan in them. But the proportions of cyan to black and whether or not it is showing correctly is something I can’t know.
FB
Fulvio_Baiarda
Oct 17, 2006
what’s the goal?

keep track of high, medium and low key pictures : )

I’m not that anal!! If you’re interested, this is what I’m doing. If not, skip far far ahead…

The point of this is for image analysis for my research. Basically I have some muscle slides which are stained to indicate whether the muscle fibres are innervated or not. Innervated fibres show up cyan and denervated ones show up black. Some denervated fibres waste away entirely to be replaced by fat, in which case after processing I am left with an empty background. Therefore, once I take photos of the slides I need to work out the percentage of cyan fibres, black fibres and empty space. The problem is, actually the cyan fibres aren’t cyan – they are a greeny bluey colour, and not even the same colour throughout (they are striated). Similarly the ‘black’ fibres are greeny-bluey-purpley black, also striated. The empty space isn’t quite empty, with a lot of remnants left behind, and even the white bits without remnants aren’t quite white due to the optimal light intensity for showing up the other features actually being rather low. Such an image poses difficulties for analysis.

The usual method, published in the medical and scientific literature, is for someone to eyeball the slide, guesstimate the percentages and get on with it. That doesn’t seem particularly scientific, but I would be ok with it as a method if it was, at least, quick and easy. However it is actually very tedious and time consuming – if you consider that each muscle section consists of about 200 photos, and I have dozens of muscle sections to get through. And at the end of a lot of work I would be left with a guesstimate of dubious value. So I’ve been looking for a better way. My original thoughts were to somehow trace the outlines of each region and measure the areas of each – eg using the colour picker and varying the fuzziness. However that didn’t pick out regions very accurately with my images, and is also labour intensive as the fuzziness of the colour selector has to be adjusted manually for each image.

To cut a long story short(ish) I have now got a method which appears to work, thanks to some of you on this forum, so many thanks. What I have done is selected representative regions of interest from slides and cloned them to make ‘pure’ selections. Note that these are pure selections of the kind of image I will be seeing, as opposed to pure cyan or pure black. So, with cloning, copying etc. I have created images consisting only of bluey-greeny-purpley black with striations, greeny-blue with striations, and dull white with remnants of rubbish in them. For these images I have obtained average RGB profiles (using the image puree method suggested earlier – Filter-Blur-Average), and then repeated the process several times with different ‘pure’ images in order to check consistency. They were pretty consistent after a few repeats, and I am using average of all the values as my controls.

Now this leaves me with 3 sets of RGB values (for black fibres, cyan fibres and empty space). Again I know that the black fibres, for example, aren’t pure black – to be exact the RGB is 59.9, 52.4 and 71.5. But I have three sets of RGB ranges with unique relative proportions, from which it is theoretically possible to calculate the proportion of each type from a ‘puree’ of any image. The idea is that I can type in an RGB profile of one of my pureed images and excel will throw out % black fibre area, % green fibre area and % empty space. I’ve been working out the maths of it for the past day but now think I have it working. The final thing I have just finished doing, in order to make sure it really works, is to artificially create some test images with known fibre type proportions. I did this by dividing the canvas into a 3 by 3 grid occupied by 9 images consisting of my ‘black’, ‘cyan’ or ’empty’ control images in different known proportions, and comparing the known proportions with what my new spreadsheet throws out based on the puree of the images. From this it appears to be accurate to within about 5%! And the result is instant!

PeterK, I think by using control image sections that are representative of my actual images that the effect you described is factored out? However I’m not totally sure I understood what you are getting it so please correct me if I’m wrong!

Right, I’ll leave off there because it is quite possible I am the only person in the world interested in all this. I am just excited it _seems_ to be working and wanted to thank you all again.

Fulvio
E
eltee
Oct 18, 2006
I’m glad it works for you and 5% error doesn’t sound like much : ) What I would do eventually on top of what you’ve done already is use a Custom CMYK profile with 400% Total Ink and even Undercolor Additions of different values.

… and try X-ray and Infrared captures of the same slides, layered in Difference blending mode, or color filters that may enhance one subject and/or blend another.

Good luck!
don’t be a stranger; I sense that every regular (is that a funny medical notion? : ) in this forum would be absolutely delighted to help in any way they can.
P
PeterK.
Oct 18, 2006
No, he wouldn’t want undercolor added, because the purpose of his measurements is to determine what proportions of cyan there is to black. Adding cyan in under the black with UCA would give him a false cyan reading. However…
Fulvio, it sounds as if you’re separating out the cyan-coloured info from the black info, which is good, since the black would also contain cyan and mess up the results of your cyan reading. As long as you take out the black, you should be getting an accurate average for the cyan-coloured portions.
DK
Doug_Katz
Oct 18, 2006
Damn! I find this research even more interesting than the Photoshop strategy for doing it! Fulvio, may I ask where you’re conducting this research? At an institute? a medical agency? privately? It’s fascinating.
FB
Fulvio_Baiarda
Oct 18, 2006
Thanks again to all of you. I’ll be sure to post here again with any problems I have, but Photoshop is one of those apps where if I dip a toe into the waters of my ignorance I may never be seen again…!

Doug, I’m having to run out right now, so you’re all spared an in-depth summary of my research (and trust me, I can talk for Britain on this!). But to try to do it in 1 sentence, I’m researching something called functional muscle transplantation – it is transplanting muscles, but not as is already done (muscles being moved about for breast reconstruction or to fill holes for people with severe bed sores), but so that the muscles will then function under voluntary control at the new location (emphasis on the ‘functional’ muscle transfer). The thrust of my research is to improve the reliability and predictability of the final result. At present this kind of thing is done almost solely to correct facial paralysis, but potential applications are pretty much limitless. I work for a surgical research charity for a few more months, until I’ve (hopefully!) finished my higher degree. If you’re interested you can check out the charity website – www.raft.ac.uk. If anyone is _really_ interested we have regular open days to the public where we talk about what research is being done (there are several different research groups – from artificial skins to scarless surgery), and I can pass on details.

Best wishes,

Fulvio

Master Retouching Hair

Learn how to rescue details, remove flyaways, add volume, and enhance the definition of hair in any photo. We break down every tool and technique in Photoshop to get picture-perfect hair, every time.

Related Discussion Topics

Nice and short text about related topics in discussion sections