Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
29th May 2004, 22:18 | #1 | Link |
Registered User
Join Date: May 2004
Posts: 12
|
Saturated colors bleed - no more
Hi! I've been working on a filter to fix a severe color bleeding problem of my low-end camcorder (JVC DVL510). I managed to fix it with this function, which works in YV12 colorspace. I hope this is usefull to somebody else.
Code:
Function FixChromaBleeding (clip input) { # prepare to work on the V channel and reduce to speed up and filter noise area = input.tweak(sat=4.0).VtoY.ReduceBy2 # select and normalize both extremes of the scale red = area.Levels(255,1.0,255,255,0) blue = area.Levels(0,1.0,0,0,255) # merge both masks mask = MergeLuma(red, blue, 0.5).Levels(250,1.0,250,255,0) # expand to cover beyond the bleeding areas and shift to compensate the resizing mask = mask.ConvertToRGB32.GeneralConvolution(0,"0 0 0 0 0 1 1 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0").ConvertToYV12 # back to full size and binarize (also a trick to expand) mask = mask.BilinearResize(Width(input),Height(input)).Levels(10,1.0,10,0,255) # prepare a version of the image that has its chroma shifted and less saturated input_c = input.ChromaShift(C=-4).tweak(sat=0.8) # combine both images using the mask return input.overlay(input_c,mask=mask,mode="blend",opacity=1) } Last edited by ajordan; 31st May 2004 at 14:16. |
31st May 2004, 07:16 | #2 | Link |
interlace this!
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
|
that's pretty good thinking there.
would a soft mask help it? (or would it just slow it down some...). i'm pretty big on soft masks, but they're not always useful.
__________________
sucking the life out of your videos since 2004 |
31st May 2004, 14:58 | #4 | Link |
Registered User
Join Date: May 2004
Posts: 12
|
@Mug: You mean to use gamma > 1.0 in Level? I don't think it would slow down at all. If I can make sure the bleeding area is well covered by the soft mask, it would reduce the risk of yanking the croma of a nearby object into the correction. Thanks for the suggestion.
|
8th November 2005, 16:38 | #5 | Link |
Pig on the wing
Join Date: Mar 2002
Location: Finland
Posts: 5,717
|
Could any MaskTools guru make a faster version of this excellent function? It seems that the discussion dried up short
__________________
And if the band you're in starts playing different tunes I'll see you on the dark side of the Moon... |
8th November 2005, 17:48 | #6 | Link |
budala
Join Date: Oct 2003
Location: U.S.
Posts: 545
|
At the risk of introducing a different but probably not better way ....
I added some functionality to Tweak a little while ago to allow targeting specific hues and saturation levels (secondary color correction). So you can target a range of red hue and a range of saturation and then bring those pixels down. It does allow a 'softening' of the saturation window by interpolating over a range instead of a sharp cutoff. This helps to reduce banding. http://www.avisynth.org/warpenterpri...l_20040412.zip [edit] #This should Target red between 115% and 75% saturation # and bring it down to 80% of the original value. # Smoothing defaults to 16 which will dampen saturations down to (75-16=59%) TweakColor(sat=0.8,startHue=80,endHue=140,maxSat=115,minSat=75) Last edited by trevlac; 8th November 2005 at 17:55. |
9th November 2005, 09:46 | #7 | Link | |
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,389
|
Quote:
For the moment, you should get a good speed gain by just replacing the slow GeneralConvolution Code:
# expand to cover beyond the bleeding areas and shift to compensate the resizing mask = mask.ConvertToRGB32.GeneralConvolution(0,"0 0 0 0 0 1 1 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0").ConvertToYV12 Code:
mask = mask.DEdgeMask(0,255,0,255,"0 0 0 1 0 0 0 0 0").DEdgeMask(0,255,0,255,"1 1 1 1 1 1 0 0 0") To produce something that's working more specific, I'd need some samples showing the problem, since I have no such ones.
__________________
- We´re at the beginning of the end of mankind´s childhood - My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!) |
|
9th November 2005, 10:25 | #8 | Link |
Pig on the wing
Join Date: Mar 2002
Location: Finland
Posts: 5,717
|
I could try to dig up some frames that have lots of bleeding, it's mostly red and blue which show the phenomenon. I'll probably transfer my last VHS camcorder tape to DVD later this week before getting my first miniDV so I might find something of interest there.
In any case, removing the need to convert to RGB32 and back is already a major point, thanks for that I wish I had the time to start learning the basics of masks but it looks like I won't till I'm old and cranky
__________________
And if the band you're in starts playing different tunes I'll see you on the dark side of the Moon... |
16th January 2006, 14:33 | #9 | Link |
Huh?
Join Date: Sep 2003
Location: Uruguay
Posts: 3,103
|
This script works pretty nicely as it is, so I don't think a rewrite is necessary, but a full optimization would be great if it means the new version would do the exact same thing as the original.
__________________
Read Decomb's readmes and tutorials, the IVTC tutorial and the capture guide in order to learn about combing and how to deal with it. |
27th February 2006, 02:08 | #11 | Link |
Huh?
Join Date: Sep 2003
Location: Uruguay
Posts: 3,103
|
__________________
Read Decomb's readmes and tutorials, the IVTC tutorial and the capture guide in order to learn about combing and how to deal with it. |
1st March 2006, 23:48 | #12 | Link |
Registered User
Join Date: Feb 2002
Location: Charlotte, NC USA
Posts: 1,984
|
Did you try Reinterpolte411? Perhaps that will reduce the initial "bleed" which is really an aspect of 4:1:1, not actual "bleed".
__________________
Reclusive fart. Collecting Military, Trains, Cooking, Woodworking, Fighting Illini, Auburn Tigers |
18th September 2006, 03:40 | #13 | Link | |
Registered User
Join Date: Apr 2006
Posts: 70
|
Quote:
Color bleeding is a real problem for my Sony MiniDV camera. Original script doesn't help, even makes things worse. Because I have bleeding shifted to the left, author has one shifted to the right. Optimisation of the script will be really appreciated. Thanks! |
|
18th September 2006, 09:04 | #14 | Link |
Registered User
Join Date: Apr 2005
Posts: 1,339
|
I've found the following to be very effective:
Code:
fft3dfilter(sigma=8,plane=3,degrid=1) Try it and see if it helps. Also, the Reinterpolate411 plugin as Fred mentioned might help a lot if it applies to your source. Last edited by Pookie; 18th September 2006 at 09:12. |
18th September 2006, 19:01 | #15 | Link | |
Registered User
Join Date: Apr 2006
Posts: 70
|
Quote:
Original: Processed: Last edited by Dr.D; 18th September 2006 at 22:47. |
|
19th September 2006, 01:03 | #18 | Link |
Registered User
Join Date: Dec 2005
Location: Sweden
Posts: 702
|
Isn't there a way to shift colour the planes with TomsmoComp?
Someone suggested me to do that when I had the same problem a long time ago. Can't find the thread though. Im almost certain it was TomsMoComp :S Last edited by anton_foy; 19th September 2006 at 01:06. |
17th March 2014, 12:49 | #20 | Link |
Registered User
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
|
I have a mod that can control result to fit source
here (now need Zs_RF_Shared.avsi V1.143 or better) it good idea to use it like this Code:
FixChromaBleedingMod(-4, 2, thr=4.0, f=false, xysh=true, bic=true, strength=1.0, opacity=1.0) #Shift only FixChromaBleedingMod(0, thr=3.0, f=false, n=true, strength=0.9, opacity=0.9) #less saturated in blue and red
__________________
See My Avisynth Stuff Last edited by real.finder; 12th January 2021 at 14:36. Reason: update to github |
Thread Tools | Search this Thread |
Display Modes | |
|
|