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 Usage
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 11th December 2008, 03:53   #1  |  Link
kemuri-_9
Compiling Encoder
 
kemuri-_9's Avatar
 
Join Date: Jan 2007
Posts: 1,348
ColorSwitch - a color-based pixel 'switcher'

I've finally become satisfied with my first filter which i have dubbed 'ColorSwitch'.

It has the ability to pick and choose pixels from input clips based on their color values on per pixel values.

I developed it to be able to selectively filter a frame based on its color values.

the basic formula of how it works is
there's 3 input clips 'scan', 'base', and 'replace'.
if scan's per pixel values is in any of the ranges you specify, it takes the respective pixel from replace.
if not, it takes it from base.

in this manner, passing
last, last, last.filtered()
can net you partial filtering based on the frame's colors

another option to using in the manner of
last, BlankClip(last, color=$000000), BlankClip(last, color=$FFFFFF)
can be used for mask creation based on the colors.

it supports up to 16 sets of color ranges, so you can nail down specific color conditions fairly well.

it also features an additional function for writing the per pixel data to file as well,
to assist with your color value choosings.

natural limitations to the filter are:
all clips must have the same width, height, and color space.
and no interlaced support....

available for dl here
__________________
custom x264 builds & patches | F@H | My Specs
kemuri-_9 is offline   Reply With Quote
Old 11th December 2008, 06:01   #2  |  Link
Adub
Fighting spam with a fish
 
Adub's Avatar
 
Join Date: Sep 2005
Posts: 2,699
Mind if I ask what the reason for this plugins creation was?
__________________
FAQs:Bond's AVC/H.264 FAQ
Site:Adubvideo
Adub is offline   Reply With Quote
Old 11th December 2008, 06:44   #3  |  Link
kemuri-_9
Compiling Encoder
 
kemuri-_9's Avatar
 
Join Date: Jan 2007
Posts: 1,348
the original reason was for the purpose selectively applying dftest on some of my anime encodes
generally didn't like how dftest came out on black -> near black sections
so just wanted to be able to specify to apply it on sections with sufficient color.

that was possible to be pulled off with creating some masks using levels() and similar color altering functions and then overlaying with it,
but that wasn't as friendly as i would of liked.
plus there may be some point in the future where i just want to filter on some specific color ranges that generating a mask would be too annoying normally.

if you can understand that at all...
__________________
custom x264 builds & patches | F@H | My Specs
kemuri-_9 is offline   Reply With Quote
Old 11th December 2008, 19:32   #4  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
Quote:
plus there may be some point in the future where i just want to filter on some specific color ranges that generating a mask would be too annoying normally.
You mean like in MaskHS?
http://forum.doom9.org/showthread.ph...51#post1078651
Wilbert is offline   Reply With Quote
Old 11th December 2008, 20:39   #5  |  Link
Adub
Fighting spam with a fish
 
Adub's Avatar
 
Join Date: Sep 2005
Posts: 2,699
Quote:
if you can understand that at all...
I have no problem understanding it. I was kind of thinking about doing the same thing. I will have to mess with this filter when I have more time.
__________________
FAQs:Bond's AVC/H.264 FAQ
Site:Adubvideo
Adub is offline   Reply With Quote
Old 11th December 2008, 21:04   #6  |  Link
kemuri-_9
Compiling Encoder
 
kemuri-_9's Avatar
 
Join Date: Jan 2007
Posts: 1,348
Quote:
Originally Posted by Wilbert View Post
if only i could DL it to see how similar it actually is,
the link in that post is dead, which is not surprising as it's nearly a year old :<
__________________
custom x264 builds & patches | F@H | My Specs
kemuri-_9 is offline   Reply With Quote
Old 11th December 2008, 21:28   #7  |  Link
squid_80
Registered User
 
Join Date: Dec 2004
Location: Melbourne, AU
Posts: 1,963
Quote:
Originally Posted by kemuri-_9 View Post
if only i could DL it to see how similar it actually is,
the link in that post is dead, which is not surprising as it's nearly a year old :<
Meh. Wilbert already added a new link but I fixed the original anyway. The actual documentation for it is here.
squid_80 is offline   Reply With Quote
Old 11th December 2008, 22:09   #8  |  Link
kemuri-_9
Compiling Encoder
 
kemuri-_9's Avatar
 
Join Date: Jan 2007
Posts: 1,348
the concept for what i did is based on specific color values, not the hue/sat value ranges like maskHS

the filter i made has the capability to create masks depending on the input clips.

the filter i have processes on raw, R,G,B,A, Y,U,V value ranges when they exist in the colorspace.
so you can select pixels based on G value ranges or A value range s, a mixture of ranges, and combinations of ranges.
ranges can also have the same min/max values, so you can nail down to a specific exact overall color (i.e. RGB24: 0x000000).
it also accepts multiple (up to 16) ranges, so if you need to have several sets of distinct colors you would like to select, it can do so

so assuming i had some RGB24 source, i could select colors in the ranges of
R=0-10, B=20-30, G=40-50
or
R=60-70, G=80-90, B=100-110
on some clip

to
1A. generate a mask
1B. generate an antimask
2A. directly selectively filter on those colors
2B. directly selectively filter on ~colors (that aren't the specified ranges)

what it generates as an end result is up to the user, as it works with clips, so you can do quite a bit with it.
__________________
custom x264 builds & patches | F@H | My Specs
kemuri-_9 is offline   Reply With Quote
Old 12th December 2008, 14:38   #9  |  Link
tin3tin
Registered User
 
tin3tin's Avatar
 
Join Date: Mar 2005
Posts: 366
Nice for red-eye-reduction:
Get this image.

And run this script:
Code:
loadplugin("ColorSwitch.dll")
ImageReader("red_eye_before470_470x386.jpg",0,0)
converttorgb24()
first=last
ColorSwitch(last,last,last.greyscale(),"R:1-170,G:0-70,B:0-130")
last+first
__________________
DVD slideshow GUI(Freeware).

Last edited by tin3tin; 12th December 2008 at 14:51.
tin3tin is offline   Reply With Quote
Reply


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 08:12.


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