Mask - Colour Range Tool

Moderator: jsachs

Marpel
Posts: 702
Joined: September 13th, 2009, 3:19 pm
What is the make/model of your primary camera?: Nikon D810
Location: Port Coquitlam, British Columbia

Mask - Colour Range Tool

Post by Marpel »

I do a lot of image compositing where I add shapes of solid colour (single hue/tone) into traditional images.

I am probably doing it wrong but, I can't seem to generate a mask for the areas of solid colour by using the Colour Range Tool.

The tool works correctly when a mask is generated for areas of similar, but varied hues, but will not generate a mask for solid blocks of a single hue/tone. When making the initial left click, the correct hue is identified and shown along the "slider" or whatever it is called, but when the "Contract" button is pressed followed by "Apply", no mask is generated.

Out of curiosity, I tried the same process on a new image made entirely of one solid hue/tone and confirmed no mask gets generated. Does this tool require at least two hues/tones to generate a mask or am I doing something wrong??

Marv

Had to edit this post and add that "Shift - Click" is between "Contract" and "Apply". Didn't want to inadvertently lead anyone to think I do not "Shift - Click" and that is why the procedure does not work.
Dieter Mayr
Posts: 453
Joined: April 24th, 2009, 11:47 am
What is the make/model of your primary camera?: Nikon D700
Location: Salzburg / Austria

Re: Mask - Colour Range Tool

Post by Dieter Mayr »

Marv,

I do not use the color range tool very often in masking.
If i need to mask a solid color I use alsmost exclusevly the brush with the similar pixles option.
Trying your method it seems to me the problem occurs because of a slight rounding error. If you expand the range just a tiny little bit with the sliders it works.
Dieter Mayr
jsachs
Posts: 4455
Joined: January 22nd, 2009, 11:03 pm

Re: Mask - Colour Range Tool

Post by jsachs »

The best way to mask areas of solid color is with the flood fill mask tool using a very small threshold. One click on the area selects the whole thing.
Jonathan Sachs
Digital Light & Color
Marpel
Posts: 702
Joined: September 13th, 2009, 3:19 pm
What is the make/model of your primary camera?: Nikon D810
Location: Port Coquitlam, British Columbia

Re: Mask - Colour Range Tool

Post by Marpel »

Dieter and Jonathan,

Thanks for the replies, and suggestions. Although I have used both suggested methods and, in certain situations, they work very well. The reason I was trying the Colour Range Tool is I occasionally am faced with quite a number of blocks of solid colour, some very small, throughout the image. This makes using the brush with similar pixels and the flood fill a bit tedious as I would have to click on all the locations, or in the case of the brush, having a giant radius so it covers most of the image. I figured the Colour Range would simplify this whole thing.

I don't understand the technicalities of the rounding error thing, Dieter, so I don't know if that translates into my laymen's description for the C R T not being able to select a single hue/tone. However, I will try your suggestion of moving the slider a wee bit.

Thanks,

Marv
den
Posts: 861
Joined: April 25th, 2009, 6:33 pm
What is the make/model of your primary camera?: Canon EOS-350D/Fuji X100T
Location: Birch Bay near Blaine, WA USA

Re: Mask - Colour Range Tool

Post by den »

Marv...

What do you mean
by being able to select a single hue/tone
???

For example, I changed the normal default Value from 100 to 75% for a Color Dialog Hexagon image and set the Color Range for the Mask Tool to mask a narrow Blue Hue [67] range, to include all Saturations at a narrow Value of 75...
H-67_S-0-100_V-75_MaskClrRangeSettings.jpg
H-67_S-0-100_V-75_MaskClrRangeSettings.jpg (44.81 KiB) Viewed 6778 times
If the 75% toned Color Hexagon were a photo, the mask would map all pixels within a narrow range centered at Hue=67 [Blue]; Saturations=0 to 100; and a narrow range centered at Value=75.

...den...
Marpel
Posts: 702
Joined: September 13th, 2009, 3:19 pm
What is the make/model of your primary camera?: Nikon D810
Location: Port Coquitlam, British Columbia

Re: Mask - Colour Range Tool

Post by Marpel »

Hey Den,

Part of my problem with some of these conversations is I don't know the technical under the hood stuff and language that yourself and others like Dieter use. So when I am asked a question or am given some info, I often am just barely hanging on the edge.

All I know is - if I use the CRT for a general image, I click on an area that has a few/number of shades of the same hue. This starts the process and identifies a hue/saturation range etc on the sliders. I then, as instructed in the literature, click the "Contract" button, then Shift + Click the same area while dragging the cursor a bit. When I then press the Apply button, the corresponding colour(s) get masked. However, if I try this with only a solid single colour, no mask is generated. To further confirm this, I generated a new image comprised of one solid colour and went through the same process and, again, no mask gets generated. That is why I was asking if the CRT required some variation in colour/tone to work, but could not work with only a single hue/tone, or I guess a whole bunch of exactly the same pixel.

I tried to answer your question before trying to understand the info you have supplied. It will take me some time and effort to slowly go through it to figure it out. Your knowledge and expertise is way above my head, but I do enjoy your posts and trying to work my way through them.

Thanks,

Marv
den
Posts: 861
Joined: April 25th, 2009, 6:33 pm
What is the make/model of your primary camera?: Canon EOS-350D/Fuji X100T
Location: Birch Bay near Blaine, WA USA

Re: Mask - Colour Range Tool

Post by den »

Mask Tool - Color Range can be used to pick a 'narrow' range of colors/tones centered about a preference 'solid' color/tone... ...for example, the following illustration has color range settings to map the "light skin" square of the Macbeth ColorChecker chart...
ClrRangeMask_Mcbeth_LightSkin.jpg
ClrRangeMask_Mcbeth_LightSkin.jpg (48.58 KiB) Viewed 6762 times
At the risk of adding more confusion until understanding is achieved, the following may be of interest...

Mask Tool -- Color Range considerations/settings for 'nearly solid' color/tone masking of non-adjoining image areas scattered throughout an image...

Color Space considerations...
(1) To mask a 'nearly solid' color/tone; not near Red in Hue [0 or 100%]; 25-75% Saturation; and 25-75% in Value... ... use the HSV color space.

(2) To mask a 'nearly solid' color/tone; not near Red in Hue [0 or 100%]; 0-50% Saturation; and between 0-25% or 75-100% in Lightness... ... use the HSL color space.

(3) To mask a 'nearly solid' color/tone; near Red in Hue [0 or 100%]; any Saturation; and any Value or Lightness... ... use the RGB color space.

Using the color space selected from above: Sample [left mouse click] an image color/tone [a vertical black line appears below each of the channel color bars]; do not Contract; manually move for each of the channel color bars, the left side white slider pointer to the right until its point touches the vertical black line; manually move for each of the channel color bars, the right side white slider pointer to the left until its point touches the vertical black line; and 'lower-left' Apply Add... ...if necessary: Add or None or Undo; re-adjust the white slider pointers and their compainion black slider pointers [applies blending gradients to the color range selection of the white slider pointers]; and 'lower-left' Apply Add... ...repeat as preferred.

Add'l Notes...
(1) Once an image color/tone has been Sampled, the Mask Tool -- Color Range color space can be changed... ...the vertical black line below the channel color bars will shift appropriately for the newly selected color space.

(2) After making the white pointer slider adjustments, make sure that the left and right sliders 'point' towards each other as they can be easily crossed where they are back to back.

(3) In PWP, Hue has discontinuity for Red at any tone [Value or Lightness] and Saturation... ...as a 'solid' Red hue can have a value of either 0% [0] or 100% [255]. Hence, a 'narrow' color/tone range centered about a Red hue may be best masked using the RGB color space when using Mask Tool - Color Range.

Hope the above is of help... ...the Mask Tool - Color Range feature can be very powerful... ...the key is masking a 'narrow' range centered about a preference 'solid' color/tone in one or more of its selected color space channels... ...then too if you are achieving your preferences via other masking methods that is the important thing!!!

...den...
Dieter Mayr
Posts: 453
Joined: April 24th, 2009, 11:47 am
What is the make/model of your primary camera?: Nikon D700
Location: Salzburg / Austria

Re: Mask - Colour Range Tool

Post by Dieter Mayr »

Marv,

I try not to be too technical (which is quiet hard if one has a techical background ... ;) )
Let's assume one of the values in the CRT tool is 0.67890123 ( 8 digits precise, all the values in percent are in between 0 and 1 ( 100%))
Due to the was the0 numbers are stored in the computer and during calculations (computers can only handle numbers at limited precision) that need to be done by the program it can (and will most likely) store this value as lets say 0.67890122 , a error of 0.00000001, not worth to mention for practical reasons of a hue or saturation or luminace, but the two values are not equal anymore.
Thats what i meant by rounding error.
One value gets in the CRT tool, due to some processing in the computer it is slightly different and the equation: ValueYouWantToMask = ValueTheToolShouldMask is not true anymore.
If you give the sliders a little "room" as Den shows in his pictures this little error is compensated.

A hopefully easy to understand example (technically not 100% correct because vales are stored in a more compicated way, and i don't think i want bother you with that, but i hope it shows the basic idea).

We all agree, i hope, the 1/3 + 1/3 + 1/3 = 1
Lets have 8 digits available 0.33333333 + 0.33333333 + 0.33333333 = 0.99999999, small rounding error to the "true" result 1

I hope it was understandable.
Dieter Mayr
jsachs
Posts: 4455
Joined: January 22nd, 2009, 11:03 pm

Re: Mask - Colour Range Tool

Post by jsachs »

I have modified the color range tool for the next maintenance release so that it should work as expected with a single color selected. In this special case, it enlarges the range very slightly to make sure the specified color is included, regardless of roundoff errors.
Jonathan Sachs
Digital Light & Color
den
Posts: 861
Joined: April 25th, 2009, 6:33 pm
What is the make/model of your primary camera?: Canon EOS-350D/Fuji X100T
Location: Birch Bay near Blaine, WA USA

Re: Mask - Colour Range Tool

Post by den »

This will be useful... ...Thank you...
Post Reply