View Full Version : "turning off" (masking out) the black pixels for color adjusting?
zee944
6th February 2009, 20:37
Is there way to temporarly "turn off" the black [0, 0, 0] pixels in an image, so RGBAdjust(Analyze=True) would leave out them from the analysis?
I'd like to finetune the colors within an image which is mostly black (it has valuable pixel information only in parts), and it's quite uncomforable thinking in as low values as 7.50, 8.11, and 11.52 (the analysis show these as average R, G, B levels). I have a reference image to tune this image to, which is mostly black too. It'd be good to just forget the black parts for a while and analyze the "colored" parts only. Is it possible?
[side note: I know that the black pixels wouldn't affect the color balance.]
IanB
7th February 2009, 07:06
...
Vid=Last
ResetMask() # Initialise a mask
ColorKeyMask($000000, 1) # Compare to black
Invert("A") # Swap opaque/transparent
Mask(BlankClip(Last, Color=$808080) # Copy mask onto a grey clip
Layer(Vid, Last, "Add") # Make black pixels grey
RGBAdjust(Analyze=True)
...
zee944
8th February 2009, 11:05
ImageReader("TD_part_black.jpg")
ConvertToRGB32
Vid=Last
ResetMask() # Initialise a mask
ColorKeyMask($000000, 1) # Compare to black
Invert("A") # Swap opaque/transparent
Mask(BlankClip(Last, Color=$808080)) # Copy mask onto a grey clip
Layer(Vid, Last, "Add") # Make black pixels grey
RGBAdjust(Analyze=True)
Is it supposed to work in the code above?
It makes no difference at the moment. The black doesn't become gray. A ')' was missing from the Mask... line, but I put it to right place.
(And when I'm finished with adjusting the colours, how can I go back to normal?)
Gavino
8th February 2009, 11:28
It makes no difference at the moment. The black doesn't become gray.
Try changing the Mask line to
Mask(BlankClip(Last, Color=$808080), ShowAlpha(last))
And when I'm finished with adjusting the colours, how can I go back to normal?
You need to save the mask and use it again to overlay your amended clip with a black one. So the whole script would become:
ImageReader("TD_part_black.jpg")
ConvertToRGB32
Vid=Last
ResetMask() # Initialise a mask
ColorKeyMask($000000, 1) # Compare to black
mask=Invert("A") # Swap opaque/transparent
Mask(BlankClip(Last, Color=$808080), ShowAlpha(mask)) # Copy mask onto a grey clip
Layer(Vid, Last, "Add") # Make black pixels grey
Newvid=RGBAdjust(...) # do adjustments
Mask(BlankClip(Last), ShowAlpha(mask)) # Copy mask onto a black clip
Layer(Newvid, Last, "Add") # Restore grey pixels to black
zee944
16th February 2009, 20:32
Ah, it works now. Thanks.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.