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. |
21st January 2005, 09:38 | #1 | Link |
Registered User
Join Date: Mar 2003
Location: Santiago de Compostela (Spain)
Posts: 27
|
How to replace one color to another ...?
Hi, I'm looking for a script / plugin / ... to replace pixel color to another color ...
Example: my short video have a red color in the backgroung and I need to change this color to green ... Thanks to all replies ..... |
21st January 2005, 18:42 | #2 | Link |
Registered User
Join Date: Oct 2001
Location: france
Posts: 521
|
Search in the documentation for the Layer() function.
with colorKeyMask() Basically you need to create a green clip, and overlay the red part with layer. Now be warned that it might work well on artificially produced color but not very much on other type of colors. (eg: something that 'looks' red...) There might be other filters that can do what you want, but depending of what are your exact needs. esby
__________________
http://esby.free.fr/ |
24th January 2005, 13:07 | #3 | Link |
Registered User
Join Date: Mar 2003
Location: Santiago de Compostela (Spain)
Posts: 27
|
Thanks esby ...
I know this functions, but I need something like this: Funtion ChangeColor( clip clip, HexOriginalColor, HexFinalColor ){} --code?--- FinalColor = $000000 clip=AVISource("myclip.avi") # Change all this colors to $000000 vidColor1 = ChangeColor(clip, $0C090A, FinalColor) vidColor2 = ChangeColor(vidColor1, $0C090A, FinalColor) vidColor3 = ChangeColor(vidColor2, $0C090B, FinalColor) FinalClip = ChangeColor(vidColor3, $0C090D, FinalColor) return FinalClip Thanks..... Last edited by ruanova; 24th January 2005 at 13:09. |
24th January 2005, 23:41 | #4 | Link |
Simply me
Join Date: Aug 2002
Location: Lancashire, England
Posts: 610
|
I've put together a simple plugin that should do what you want
Try getting it from here (right-click and use save as) regards Simon
__________________
http://www.geocities.com/siwalters_uk/fnews.html |
25th January 2005, 19:11 | #6 | Link | |
Simply me
Join Date: Aug 2002
Location: Lancashire, England
Posts: 610
|
Quote:
If the plugin works OK, I'll change to using named parameters. Any idea's about improving it would be welcome regards Simon
__________________
http://www.geocities.com/siwalters_uk/fnews.html |
|
28th January 2005, 19:19 | #9 | Link | |
budala
Join Date: Oct 2003
Location: U.S.
Posts: 545
|
Quote:
The colors (and clip colorspace) is RGB. So the hex values are RGB colors. RRGGBB where each pair runs 0-255 or 00 to FF in hex. I believe Simon has a vdub color picker that would give you the values. Any tool with a color picker would work. ----------------------------- It was nice of Simon to put this together for the requester and it sounds like it is what that person needed. However, if I may comment on the troubles with this approach. Unless the colors are pure it's a bit of a pain to specify them all (as Wilberts tolerances comment). Plus, even specifying tolerances (especially in RGB) would be hard. --------------------- I worked on this problem a bit ago with a filter that started with tweak and added some color adjustments. I called it tweakcolor. Here is the 1st thread ... but I think I explained it a few times if you search for tweakcolor: http://forum.doom9.org/showthread.php?s=&threadid=74334 This filter works in YUY2 and does some interpolation so there are no sharp intensity/saturation changes, like you might get if you only pick 1 color or even a range. I mainly use this to change the saturation of just a specific color (like red), but you can also use it to swing the hue around. I believe I put a bunch of examples in the zip file. |
|
28th January 2005, 20:24 | #10 | Link |
budala
Join Date: Oct 2003
Location: U.S.
Posts: 545
|
Ha!
I read about Tweakcolor and found it all to be a bit confusing. Plus, I couldn't find some stuff I know I put out there. Anywho .... try tweak the internal avs filter 1st. This will let you change the hue ... and you might get the idea. Look at doom9 analog capture guide section 15 for some more info on color. There is a color wheel there. 0 degrees is at 3 o'clock. Next try tweakcolor ... here is an example explained ## Change Green Range to Red ## TweakColor(hue=-120,startHue=200,endHue=260) Green is a hue of 230 degrees (about 7 o'clock). Give it a range to get the green like colors of 200 to 260. Tweak says it will change the hue by -180 to 180 degrees. Red is 110 degrees (11 o'clock). We want to swing from 7 to 11 or from 230 degrees to 110 degrees. Please note that the degrees on the color wheel don't match a clock that well because they don't start at the same point and the numbers go opposite directions. 0 deg is 3:00, 90 deg is 12:00, 180 deg is 9:00, 270 deg is 6:00, 359 deg is just after 3:00. Best to forget the clock, look at the color wheel and draw a circle on some paper. So ... AVS Tweak doc says "Positive values shift the image towards red. Negative values shift it towards green. " We want to go from green to red or 230 to 110. It's fairly clear to me that this is a 120 degree shift. Positive or negative seems unclear. But I believe when DG made Tweak he just drew a horizontal line across the color circle and said if you move counter clockwise it is positive and clockwise it is negative. In this case moving blue counter clockwise (positive) would make it more red, and moving blue clockwise (negative) would make it more green. So ... we no doubt want to move clock wise from 230 to 110 or negative 120. To summarize TweakColor(hue=-120,startHue=200,endHue=260) means move a hue range of 200 to 260 (green) clockwise (negative) around the color wheel 120 degrees to where red lives. And the greens will be red. To really do this you probably want to only go after certain intensities/saturations of green (like the bright greens) you need to muck with the sat/intsity start and end values for that. ------------------ Hope this helps someone. It can't be really that hard if I figured it out. |
Thread Tools | Search this Thread |
Display Modes | |
|
|