Log in

View Full Version : is there any filter that can change hue for different hue range?


lansing
6th January 2013, 05:55
i'm trying to match the color of two clips with the same content. I tried tweak, but it can only adjust the saturation of a hue range. I tried coluorlike, it did some job but still pretty off from my desired output.

i'm looking for something like this that can match it automatically by clicking:
http://www.youtube.com/watch?v=nZp3a-r5OFg

or something like the hue/saturation function in photoshop that can give me six hue range, each with its saturation and brightness that can be adjusted.

Gavino
7th January 2013, 16:36
I tried tweak, but it can only adjust the saturation of a hue range.
Tweak (http://avisynth.org/mediawiki/Tweak) can adjust both hue and saturation of pixels within a specified hue range.
(It can also do the same adjustments for pixels within a specified saturation range.)

lansing
7th January 2013, 17:20
can you give me an example, like i wanted to change the green to blue?

poisondeathray
7th January 2013, 21:10
can you give me an example, like i wanted to change the green to blue?

e.g

before


colorbars()
converttoyuy2()




after


colorbars()
converttoyuy2()
tweak(starthue=200, endhue=260, hue=245, sat=2, coring=false)





For different hue ranges over 3way (e.g. 3 way color corrector in NLEs like FCP), one way is to simulate this is to apply through a luma mask (shadows, midtones, highlights) . (I like 3 ways :devil: )

Gavino
7th January 2013, 21:24
can you give me an example, like i wanted to change the green to blue?
You will probably have to experiment with the numbers to fit your particular clip, but for a starting point try
Tweak(hue=-125, startHue=200, endHue=260)

The specified hue adjustment (here -125) will be applied to pixels with a hue in the range 200 to 260 (corresponding approximately to green). To fit your case, you may also need to adjust saturation and/or supply a source saturation range (maxSat and minSat).

EDIT: poisondeathray beat me to it. :)

lansing
8th January 2013, 06:05
thanks for the start up, so far i got something like this, where i add slider in avspmod so i can adjust them faster:

Tweak(hue=[<"cyan", -180, 180, 0>], startHue=275, endHue=310, sat=[<"cyan sat", 0, 2.0, 1.0>], dither=true)
Tweak(hue=[<"blue", -180, 180, 0>], startHue=325, endHue=15, sat=[<"blue sat", 0, 2.0, 1.0>], dither=true)

i have each hue range added, but how do i adjusted each of them in reference to the original clip without them overwriting each other? For example on the above, if i change the hue of "cyan" to blue, that next Tweak will take the last one as reference instead of the original.

And i noticed that in avspmod's preview window, it has the hex number representing the current color that my mouse was pointing to, can that be translated to the appropriate degree in the hue range?

IanB
8th January 2013, 22:28
MaskHS() uses the same selection code as Tweak() but returns a mask of the matching areas instead of operating on the areas. So build the 2 masks based on the unaltered input clip and use them to select the relevant matching areas. As the masks are the size of the chroma planes working in YV24 makes this easier.

Something like this :-...
ConvertToYV24()
CyanMask=MaskHS(startHue=275, endHue=310)
BlueMask=MaskHS(startHue=325, endHue=15)

CyanClip=Tweak(hue=[<"cyan", -180, 180, 0>], sat=[<"cyan sat", 0, 2.0, 1.0>], dither=true)
BlueClip=Tweak(hue=[<"blue", -180, 180, 0>], sat=[<"blue sat", 0, 2.0, 1.0>], dither=true)

Overlay(CyanClip, mask=CyanMask)
Overlay(BlueClip, mask=BlueMask)

ConvertToYV12()

IanB
8th January 2013, 22:42
What Tweak() and MaskHS() call hue is :-

. Hue = atan2(V-128, U-128) * 180.0 / PI

So you need to convert your hex value of a RGB colour into a YUV value then do the above with the U and V values.

lansing
11th January 2013, 07:00
Thanks IanB, I finally get the hue mask working, I've stuck at the setup stage for a while because MaskHS doesn't have "sat" argument, it's all good now.


ConvertToYV24()

## Hue Mask
CyanMask=MaskHS(startHue=275, endHue=310)
BlueMask=MaskHS(startHue=325, endHue=15)
RedMask=MaskHS(startHue=90, endHue=110)

## mask tweak
CyanClip=Tweak(hue=[<"cyan", -180, 180, 0>], sat=[<"cyan sat", 0, 2.0, 1.00>], bright=[<"cyan bright", -255, 255, 0>], dither=true)
BlueClip=Tweak(hue=[<"blue", -180, 180, 0>], sat=[<"blue sat", 0, 2.0, 1.00>], bright=[<"blue bright", -255, 255, 0>], dither=true)
RedClip=Tweak(hue=[<"red", -180, 180, 0>], sat=[<"red sat", 0, 2.0, 1.00>], bright=[<"red bright", -255, 255, 0>], dither=true)

Overlay(CyanClip, mask=CyanMask)
Overlay(BlueClip, mask=BlueMask)
Overlay(RedClip, mask=RedMask)

ConvertToYV12()



each mask is now able to adjust it's own saturation, brightness, hue and contrast.

One thing that is really missing in both tweak and MaskHS is the mask to show the hue range that's been selected with startHue and endHue. I'm having a hard time spotting the hue range i wanted without the mask.

And for the color hex, i just figured that i can simply enter it into photoshop's color picker and it will give me all the info including the hue degree.

lansing
11th January 2013, 10:41
Tried to tweak it for a couple of hours, maskhs needs to have a feather function to smooth out the edges of the mask. Right now it's impractical to use on anime, where I can see the blocky edge of the mask along the lineart.

poisondeathray
11th January 2013, 16:05
Tried to tweak it for a couple of hours, maskhs needs to have a feather function to smooth out the edges of the mask. Right now it's impractical to use on anime, where I can see the blocky edge of the mask along the lineart.

can't you just add a blur to the mask ?
eg.
BlueMask=MaskHS(startHue=325, endHue=15).binomialblur(5)

IanB
11th January 2013, 21:52
Oops, sorry I cloned the Sat argument lists incorrectly :o I've fixed my post above.

MaskTools has some useful functions for managing the edges of masks.

If you just blur the mask the edge pixel becomes 50%. This may be okay, but sometimes you need the mask edge preserved and the feathering to extend into the adjacent area, sometimes you need the adjacent area edge preserved and the feathering to be constrained to the mask. The MaskTools functions impand and expand, along with other functions can help.

Also to see what your mask is currently selecting, just kill the main clip before the overlay call. e.g...
RedClip=...

BlankClip(Last) # Replace current clip with blank clone

Overlay(CyanClip, mask=CyanMask)
# Overlay(BlueClip, mask=BlueMask)
# Overlay(RedClip, mask=RedMask)

ConvertToYV12()

lansing
12th January 2013, 11:59
After a few days of testing, I give up doing it on avisynth. Color correcting without a proper GUI is a pain in the butt by itself, let alone the amount of time spend on creating masks that were smart enough to avoid the pitfalls.

I tried magic bullet colorista today, and its hsl color correction method seems to work for me. It has two tracking balls, each with 8 color range; one ball to adjust hue and saturation, and the other ball adjust brightness, while each ball limiting one another. I was able to get the color I wanted a lot easier.

jhon marvi
5th February 2013, 07:27
How do i adjusted each of them in reference to the original clip without them overwriting each other?:helpful: