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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 10th December 2009, 21:48   #1  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,496
selectivecolour - highly experimental clone of Photoshop's Selective Colour as filter

WARNING: This filter is highly experimental, and also probably very badly written. It was written by me for very specific purposes, but I thought it might just be useful to somebody, somewhere.

Update: the filter's now written a bit better, doesn't suffer from pitch problems, and is multithreaded.

This filter partially copies the actions of Photoshop's "Selective colour" image adjustment action. Apart from an input clip (which must be RGB32) it takes 19 arguments.

The first 18 are floats in the range -1 to 1 (other values are accepted, but that behaviour is not well defined). These are in groups of three, representing the Cyan, Magenta, and Yellow %ages (normalised) present in Photoshop's Selective Color dialogue for each of the six colour sections (reds, yellows, greens, cyans, blues, magentas).

The last is a boolean to choose either relative (false) or absolute (true) mode, as per the Photoshop dialogue box.

Usage:

Code:
avisource("...")
converttorgb32
selectivecolour(last,\
0.5,0,0,\
0.25,0.1,0,\
1,-0.5,-0.25,\
-0.5,0.5,-0.5,\
0.1,0.2,0.3,\
-0.1,-0.2,-0.3,\
true)
The six triples act on the following sets of pixels (a pixel may be a member of up to 2 adjacent sets):

Reds: those pixels where R>G and B
Yellows: R and G>B
Greens: G>R and B
Cyans: G and B>R
Blues: B>R and G
Magentas: R and B>G

The first number in a triple alters the Red channel, the second the Green channel, the third the Blue channel. Because Photoshop calls these values Cyan, Magenta and Yellow, the numbers work backwards - if you want to increase the intensity of a channel, use a negative number, and vice versa.

The filter doesn't currently implement the "Black" value in Photoshop.

The filter may fail to work correctly when a clip has been cropped horizontally (because source and destination may not have the same pitch). This bit no longer true!

Any use to anyone?

David
Attached Files
File Type: zip selectivecolour.zip (6.8 KB, 241 views)

Last edited by wonkey_monkey; 8th October 2011 at 22:57.
wonkey_monkey is offline   Reply With Quote
Old 11th December 2009, 03:55   #2  |  Link
markanini
Registered User
 
Join Date: Apr 2006
Posts: 299
Cool.
markanini is offline   Reply With Quote
Old 11th December 2009, 17:44   #3  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,496
Proper download link:

selectivecolour.zip

David
wonkey_monkey is offline   Reply With Quote
Old 11th December 2009, 18:43   #4  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
If you included the source code, we could probably help you with the pitch problems.
Gavino is offline   Reply With Quote
Old 11th December 2009, 20:45   #5  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,496
Quote:
Originally Posted by Gavino View Post
If you included the source code, we could probably help you with the pitch problems.
No need, but thanks - as I said, I wrote it as a quick-and-dirty solution to a very specific problem. I know what the pitch problem is, and how to fix it, but I'm ignoring it because it's not a factor to me (my source video is never cropped).

I just thought I'd post this first to see if there was enough interest to warrant tidying it up. I spent far longer working out how Selective Colour works than I did writing the plugin, as you'd probably be able to tell if you saw the source!

David
wonkey_monkey is offline   Reply With Quote
Old 20th October 2011, 19:13   #6  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,496
I hope it's not too immodest to bump my own ancient thread, but I've updated the filter. It's now multithreaded and the pitch problem is fixed. Plus, I've finally found someone besides myself who has a use for it.

David
wonkey_monkey is offline   Reply With Quote
Old 20th October 2011, 19:25   #7  |  Link
Mounir
Registered User
 
Join Date: Nov 2006
Posts: 773
Can you post pictures before/after please i hate when guys post their scripts and we don't know what to expect

Edit:
Something like THIS ?

Last edited by Mounir; 20th October 2011 at 19:31.
Mounir is offline   Reply With Quote
Old 20th October 2011, 19:41   #8  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,496
As a matter of fact, exactly like that - barring rounding errors. You're right, I should have posted some images - I wrongly assumed familiarity with Photoshop. I can't find a much better example than those on that page, so:



David
wonkey_monkey is offline   Reply With Quote
Old 20th October 2011, 20:50   #9  |  Link
Hiritsuki
Novice of AVS
 
Join Date: Oct 2009
Posts: 156
Hi, can you tell me that parameter how to use?
__________________
My PC
Hiritsuki is offline   Reply With Quote
Old 8th July 2015, 04:23   #10  |  Link
geminihc
Registered User
 
Join Date: Jan 2008
Posts: 2
sorry to revive this thread but i CANT find anything like this!

but i'm abit technically challenged, can someone tell me how i can use this with Potplayer? There is a avisynth button , i've installed avisynth, and entered the DLL, and entered the script above but nothing seems to change. i'm not sure if avisynth is even on...

i'm looking to change the color of someone hair in a video, during real-time playback
geminihc is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 16:45.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.