Select Pixels by Hue

ZB
Posted By
Zack Black
Sep 30, 2006
Views
1716
Replies
8
Status
Closed
Is there a way to select all pixels in an image with an exact hue? Neither the magic wand nor "Color Range" menu seem to give me enough control to do this. Am I missing something?

Zachary Black
Z Sculpt Entertainment

http://www.zsculpt.com

MacBook Pro 16” Mockups 🔥

– in 4 materials (clay versions included)

– 12 scenes

– 48 MacBook Pro 16″ mockups

– 6000 x 4500 px

GH
Gernot Hoffmann
Sep 30, 2006
Zachary,

that’s generally impossible, because a gray (or a color
near to gray) doesn’t have a (well) defined hue.
Of course it would be possible to use an algorithm
like this:
If (saturation> 0.05) And (hue-eps <= hue1 <= hue+eps) Then select the pixel.
eps is a small number (in degrees, eps=0 for your appli- cation).
No idea, how to apply such a strategy by PhS.

Best regards –Gernot Hoffmann
MR
Mike Russell
Oct 1, 2006
wrote in message
Zachary,

that’s generally impossible, because a gray (or a color
near to gray) doesn’t have a (well) defined hue.
Of course it would be possible to use an algorithm
like this:
If (saturation> 0.05) And (hue-eps <= hue1 <= hue+eps) Then select the pixel.
eps is a small number (in degrees, eps=0 for your appli- cation).
No idea, how to apply such a strategy by PhS.

One way to accomplish this is to convert the image to Lab mode, dup to a new layer, make your changes, and then use the Blend If sliders to select a range of the a and b channels.


Mike Russell
www.curvemeister.com/forum/
GH
Gernot Hoffmann
Oct 1, 2006
Mike,

even if we consider Lab-hue as hue, your suggestion doesn’t solve the OP’s technical problem:
The Lab-hue is defined by a ratio a:b or b:a instead of a range or number pair for (a) and (b).
Mathematically: hue=atan2(b,a), mapped into the angle range 0° to 360°.
Nevertheless thanks for informing us about special PhS features.

Best regards –Gernot Hoffmann
MR
Mike Russell
Oct 1, 2006
wrote in message
Mike,

even if we consider Lab-hue as hue, your suggestion doesn’t solve the OP’s technical problem:
The Lab-hue is defined by a ratio a:b or b:a instead of a range or number pair for (a) and (b).

Right. The range of the a and b channels are and’ed together, so you effectively select a range of hue angles, rather than a single hue angle. This is not a problem for most images.

A layer mask may be used in the duplicate layer for any remaining clean up, and you can also select based on the Lightness channel. Using the Blend If sliders in Lab mode is an effective way to select an object based on its color.

Mathematically: hue=atan2(b,a), mapped into the angle range 0
ZB
Zack Black
Oct 2, 2006
Zack Black wrote:
Is there a way to select all pixels in an image with an exact hue? Neither the magic wand nor "Color Range" menu seem to give me enough control to do this. Am I missing something?

Thanks for the quick responses guys, but I maybe started us off on the wrong track. Sometimes I use Photoshop as a programmer’s tool to analyze graphics pixel-per-pixel, and this is such a case.

Using Photoshop’s (CS 2) Info pane, the HSB displays shows a hue for each pixel you hover over, from 0-360°. What I’m looking for is perhaps an obscure plug-in or buried feature that would allow me to select every pixel in an image with an exact hue reading of say 75°. Does this make more sense?

P.S. I think I’ve seen older newsgroup posting referencing setting for the Magic Wand that would do this in older versions of Photoshop (I think version 5.x). Can anyone confirm this?

(Quick FYI: Realistically speaking, no, gray has no hue or is undefinable, but in the programming world using HSB or HSV pixels, gray defaults to 0°, which is actually red. 🙂
GH
Gernot Hoffmann
Oct 2, 2006
Zack,

no – it doesn’t make more sense. Your task was already
well understood, IMO.
A gray doesn’t have any well defined hue, therefore it’s IMPOSSIBLE to select arbitrary pixels by hue, unless you define a threshold by a minimum saturation, as already
explained.

http://www.fho-emden.de/~hoffmann/hlscone03052001.pdf

It doesn’t help to define gray by hue=0°. This will cause terrible discontinuities in image processing, if the gray is drifting towards a a ‘tinted’ gray.

Best regards –Gernot Hoffmann
MR
Mike Russell
Oct 2, 2006
"Zack Black" wrote in message
….
Using Photoshop’s (CS 2) Info pane, the HSB displays shows a hue for each pixel you hover over, from 0-360
M
maria
Oct 3, 2006
On 29 Sep 2006 17:39:48 -0700, "Zack Black"
wrote:

Is there a way to select all pixels in an image with an exact hue? Neither the magic wand nor "Color Range" menu seem to give me enough control to do this. Am I missing something?

Zachary Black
Z Sculpt Entertainment

http://www.zsculpt.com

There is a filter called "Hue Transparency" by Visual Manipulation. It allows you to make all the pixels of certain color transparent at various degrees of transparency. I use it to apply all kinds of hues to various parts of my images. Unfortunately, although I can find many visual manipulation filters, I cannot locate that particular one right now. You can download the filters at:

http://www.photoshop-filters.com/html/visman.htm

maria

How to Improve Photoshop Performance

Learn how to optimize Photoshop for maximum speed, troubleshoot common issues, and keep your projects organized so that you can work faster than ever before!

Related Discussion Topics

Nice and short text about related topics in discussion sections