Log in

View Full Version : Problem with chroma correction


valja
29th March 2005, 12:10
I have a problem with coding a rip from an old VHS tape. All the film is heavily red. I tried RGBadjust(), but colour distortion is so big, that during RGB conversion some areas of red are out of valid range - over 255 - and therefore clipped to 255. So after shifting red in RGBadjust(), bright (white) areas have lack of red. I tried ColorYUV() to do the same red shift in UYV colourspace (shifting U up and V down accordingly). Result was not better.

Then I noticed, that white areas are already nearly in balance, and after constant red shift (using RGBadjust()or ColorYUV()), white areas lacks red, but darker areas need even bigger red shift. That ruled me to idea, that here change of V should not be a constant, but depend of overall brightness (Y channel) - something like
V(new) = V(old) + off_v * (255 - Y)/255
Could such idea work? AFAIK, there is no such filter to check it :( More details about a problem you can find here (http://forums.virtualdub.org/index.php?act=ST&f=5&t=9337&).

Didée
29th March 2005, 14:32
With MaskTool's commands YV12lut(), RGBlut() and the LUTxy counterparts of both, you can do almost every possible transformation by yourself.

The luma-dependant transformation of the V channel you posted could basically look like

offset = 20 # e.g.
source = last
YtV = source.FitY2V() # push Y channel into V channel to enable a f(Y,V) calculation through LUTxy

new = yv12lutxy(source, YtV, "x","x","x "+string(offset)+" 255 y - 255 / * +", Y=2,U=2,V=3)

valja
29th March 2005, 18:25
Big thanks, this package did the job! Of course, such linear dependence was a bit too strong, but now I can play with parameters (say modify extracted Y channel using levels or do chroma shift in two steps etc).