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

Reply
 
Thread Tools Search this Thread Display Modes
Old 15th July 2013, 21:45   #1  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
RgbAmplifier - Forensic Tool - v1.04 - 28 Nov 2018

Originally prompted by post #3 below, has been moved into this thread from another.

RgbAmplifier, Concept by Forensic, Plugin by StainlessS, mod ideas Gavino.

Plugins for avs v2.58, avs/+ v2.60 x86 & x64

Code:
RgbAmplifier (RGB24 and RGB32), requires VS2008 CPP Runtimes.
========================================
An Avisynth plugin to amplify color shifts

Given a clip, this filter examines every pixel of every frame and independently multiplies the difference of its specific
 R, G and B values from the average R, G and B values of that same pixel location spanning a defined radius of adjacent frames.
 If the new values are above or below the allowed RGB values, they are capped at those limits.
 The revised RGB values replace the original values, and the amplified clip is returned.
 If the Multiplier is set to a value of zero, the plugin acts as a temporal frame averager.

This plugin will:
 Convert seemingly imperceptible color changes into obvious color changes
 Highlight seemingly imperceptible movements of high contrast pixels
 Sharpen the details of moving objects
 Cause distortion or ghosting/transparency effect to moving objects (an unavoidable side effect)

This plugin requires RGB24 or RGB32 color space, and is intended for forensic analysis of videos created from fixed position cameras.
 Usage on non-stationary cameras may produce unpredictable or content destructive results. The faster the object and/or the greater
 the radius, the greater the risk of negatively impacting the visual accuracy of the moving object.

=====
Usage
RgbAmplifier(clip clip,int "Radius"=2,float "Multiplier"=2.0,int "Rmin"=0,int "GMin"=0,int "Bmin"=0, \
    int "RMax"=255,int "GMax"=255,int "BMax"=255,bool "Precise"=false)


=====
Parameters:
 Radius: integer from 1 to 99 (default 2). Defines the radius of how many frames are to be averaged (2 * radius -1).
 For example, a radius of 7 will instruct the filter to average 13 frames (2 * 7 -1).
 A value of 1 effectively disables the function (useful if adjusting the values within AVSpmod).

Multiplier: float from >=0.0 to <=20.0 (default 2.0). Defines the multiplier for the difference between a pixel’s color value
 (for each of R, G and B values) and its average value (as defined by the Radius).
 For example, the default value of 2.0 will replace every R, G and B value of every pixel with a value twice as far from the
 average R, G or B value of that pixel.

Rmin: integer from 0 to 255 (default 0). Cannot be greater than Rmax.
 The filter will not alter any pixel whose Red color value is below this threshold value.

Gmin: integer from 0 to 255 (default 0). Cannot be greater than Gmax.
 The filter will not alter any pixel whose Green color value is below this threshold value.

Bmin: integer from 0 to 255 (default 0). Cannot be greater than Bmax.
 The filter will not alter any pixel whose Blue color value is below this threshold value.

Rmax: integer from 0 to 255 (default 255). Cannot be less than Rmin.
 The filter will not alter any pixel whose Red color value is above this threshold value.

Gmax: integer from 0 to 255 (default 255). Cannot be less than Gmin.
 The filter will not alter any pixel whose Ged color value is above this threshold value.

Bmax: integer from 0 to 255 (default 255). Cannot be less than Bmin.
 The filter will not alter any pixel whose Blue color value is above this threshold value.

Precise: bool default false. Default uses integer math and is faster than Precise=true which uses double precision Floating point.

=====
Examples:

Double pixel color deviations from the average of the current, preceding and postceding frame’s pixel value
RgbAmplifier ()


Temporal averaging using the current frame and the first four (Radius - 1) preceding and postceding frame’s pixel values
RgbAmplifier (Radius=5, Multiplier=0.0)


Triple pixel color deviations from the average of the current frame and the first two preceding and postceding frame’s
 pixel values, but only for pixels with a color within 2% of pure Cyan (“00AEEF”)
 RgbAmplifier (Radius=2, Multiplier=3, Rmin=0, GMin=169, Bmin=234, RMax=5, GMax=179, BMax=244)


#########################################
Forensic
dll's, + Source + full VS2008 project files for easy build.
For Download see below MediaFire in sig.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 28th November 2018 at 11:35. Reason: Update
StainlessS is offline   Reply With Quote
Old 17th July 2013, 14:13   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Below few posts moved from another thread.

Forensic, how bout this as template

Code:
Function RgbAmplifier (clip clip, int "Radius", float "Multiplier") {
    # Radius==1, switches OFF, Radius==2 = Diameter of 3 frames
    Radius=Default(Radius,1)
    Multiplier=Float(Default(Multiplier,2.0))
    Assert(Radius>=1 && Radius <= 99,"RgbAmplifier: Radius range 1->99 ("+String(Radius)+")")
    Assert(Multiplier>0.0 && Multiplier<10.0,"RgbAmplifier: 0.0 < Multiplier < 10.0  ("+String(Multiplier)+")")
    GScript("""
        WW=clip.Width() HH=clip.Height() FC=clip.Framecount()
        clipfinal=0
        for(i=0,FC-1) {
            RT_Debug("Frame="+String(i))
            clip2=clip.trim(i,-1)
            rangemin = Max(i-(Radius-1),0)
            rangemax = Min(i+(Radius-1),FC-1)
            diameter = rangemax - rangemin + 1
            for(y=0,HH-1) {
                for(x=0,WW-1) {
                    red=0       green=0     blue=0
                    redavg=0    greenavg=0  blueavg=0
                    for(j=rangemin,rangemax){
                        col = clip.RT_RGB32AsInt(n=j, x=x, y=y)
                        b=RT_BitAND(col,$FF)    col=RT_BitLSR(col,8)
                        g=RT_BitAND(col,$FF)    col=RT_BitLSR(col,8)
                        r=RT_BitAND(col,$FF)
                        redavg      = redavg    + r
                        greenavg    = greenavg  + g
                        blueavg     = blueavg   + b
                        if(j==i) {
                            red     =   r
                            green   =   g
                            blue    =   b
                        }
                    }
                    redavg = Float(redavg) / diameter
                    newred = Round(red + (Multiplier * ( red - redavg)))
                    newred = Max(Min(newred,255),0)
                    ###
                    greenavg = Float(greenavg) / diameter
                    newgreen = Round(green + (Multiplier * ( green - greenavg)))
                    newgreen = Max(Min(newgreen,255),0)
                    ###
                    blueavg = Float(blueavg) / diameter
                    newblue = Round(blue + (Multiplier * ( blue - blueavg)))
                    newblue = Max(Min(newblue,255),0)
                    ###
                    clip2=clip2.Overlay(clip2.BlankClip(pixel_type="RGB32", color=((newred*256+newgreen)*256)+newblue).crop(0,0,1,1),
						\ x=x, y=y, opacity=1.0)
                }
            }
            clipfinal=(clipfinal.IsClip()) ? clipfinal++clip2 : clip2
        }
        return clipfinal
    """)
}

Avisource("D:\avs\test.avi").ConvertToRGB32()
trim(1000,-200)
crop(32,32,32,32)
RgbAmplifier(2,1.1)
EDIT: Fixed color shifts.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 3rd June 2014 at 16:30.
StainlessS is offline   Reply With Quote
Old 18th July 2013, 08:05   #3  |  Link
Forensic
Registered User
 
Join Date: Apr 2008
Location: California, USA
Posts: 127
Increasing a video's gamma or histogram profile can brighten a seemingly black nighttime surveillance video. However, with only 256 shades of YUV illumination, the results can fail to be forensically useful. My idea is to amplify subtle color changes to detect movement, amplify signage (logos, license plates, etc...), and other forensic needs. Besides the obvious use with low quality surveillance video, the exaggerated color shifts would allow anyone to see the normally imperceptible temperature changes. For example, machinery heating up (and thus red incremented by one in RGB space).

HOW IT WORKS:
The filter selects the upper left most pixel and reads its RGB values along with those from the preceding and postceding "N" frames. It then averages those temporal values and subtracts that average from the current frame's R G and B pixel values. It then multiplies that difference by "M", and add it to the original RGB pixel values, the resulting RGB values are an exaggeration of the color deviation from average at that one pixel. The process is repeated for every pixel of every frame, which amplifies any changes that are occurring, even if the scene appears almost completely dark. The resulting scene will look over saturated, and poison noise will become amplified, but the goal is to provide a forensic tool.

While the concept and code are correct, the original code below suffers from an Overlay memory leak issue (that I was previously unaware of) and speed issues. I am posting the original code to serve as a programming tutorial.


USAGE:
Avisource("D:\avs\test.avi").ConvertToRGB32()
A=RgbAmplifier(2,1.1)
StackHorizontal(A)


Code:
function RgbAmplifier (clip clip, int range, float magnifier) {
 GScript("""
  clipfinal=clip.trim(1,1)
  clip=clip.trim(1,1)+clip  #resolves the trim (0,0) error

  for (f=1,clip.framecount,1) {
   clip2=clip.trim(f,f)
   clip2
   rangemin=(f-range<1)?1:f-range
   rangemax=(f+range>clip.framecount)?clip.framecount:f+range

   for (x=0,clip2.width-1,1) {
    for (y=0,clip2.height-1,1) {
     current_frame=0
     redavg=0
     red=clip.RT_RgbChanMedian(n=0, delta=0, x=x, y=y, w=1, h=1, interlaced=false, chan=0)
     for (g=rangemin,rangemax,1){ redavg=redavg+clip.trim(g,g).RT_RgbChanMedian(n=0, delta=0, x=x, y=y, w=1, h=1, interlaced=false, chan=0) }
     redavg=redavg/(g-rangemin)
     newred=red+magnifier*(red-redavg)
     newred=newred>255?255:newred<0?0:newred

     current_frame=0
     greenavg=0
     green=clip.RT_RgbChanMedian(n=0, delta=0, x=x, y=y, w=1, h=1, interlaced=false, chan=1)
     for (g=rangemin,rangemax,1){ greenavg=greenavg+clip.trim(g,g).RT_RgbChanMedian(n=0, delta=0, x=x, y=y, w=1, h=1, interlaced=false, chan=1) }
     greenavg=greenavg/(g-rangemin)
     newgreen=green+magnifier*(green-greenavg)
     newgreen=newgreen>255?255:newgreen<0?0:newgreen

     current_frame=0
     blueavg=0
     blue=clip.RT_RgbChanMedian(n=0, delta=0, x=x, y=y, w=1, h=1, interlaced=false, chan=2)
     for (g=rangemin,rangemax,1){ blueavg=blueavg+clip.trim(g,g).RT_RgbChanMedian(n=0, delta=0, x=x, y=y, w=1, h=1, interlaced=false, chan=2) }
     blueavg=blueavg/(g-rangemin)
     newblue=blue+magnifier*(blue-blueavg)
     newblue=newblue>255?255:newblue<0?0:newblue

     clip2=clip2.Overlay(clip2.BlankClip(pixel_type="RGB24", color=newred*65536+newgreen*256+newblue).crop(0,0,1,1), x=x, y=y, opacity=1.0)
    }
   }
  clipfinal=clipfinal+clip2
  }
 return clipfinal.trim(1,0)
 """)
}

Last edited by Forensic; 24th July 2013 at 08:42. Reason: From other thread
Forensic is offline   Reply With Quote
Old 18th July 2013, 09:27   #4  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by Forensic View Post
I also believe that all the OVERLAY commands are adding to my memory consumption and time issues.
Overlay() is a known memory hog.
Since you are dealing with RGB, it can be replaced here by Layer().
This won't cure all the problems, but should help.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 18th July 2013, 12:14   #5  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Forensic, I only posted that as a "template/prototype", I am doing it as plugin, just advising of equivalent functionality.
(EDIT:- giving you opportunity to complain about it)
I am part way implemented but will probably take a few more days as I have several commitments that I
cant escape and probably will be compelled to spend some time in the boozer.

(Layer and Overlay will not actually come into it).

EDIT:- 99 max Radius seems a bit high, if jumping about would need to read in (99-1)+(99-1)+1 ie 197 frames
and that would require a long time. Do you have a more realistic maximum, even a radius of 10 would
require 19 frame read.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 19th July 2013 at 14:21.
StainlessS is offline   Reply With Quote
Old 18th July 2013, 15:37   #6  |  Link
Forensic
Registered User
 
Join Date: Apr 2008
Location: California, USA
Posts: 127
Thank you - thank you

Gavino - Thank you for confirming my suspicion regarding overlay

StainlessS - It works great when I make my test video extremely small, so no complaints. I saw no harm to having a 99 radius as it would only consume more of the user's computer time but, if it is an issue for your coding, make the limit whatever you need it to be. Personally, I am happy at a maximum of 9 but was trying to think of how others might use it in the future.

Also, to give this plug the greatest flexibility for future usage by everyone (and to make it nearly immune to poison and salt-pepper noise), could you add 6 optional parameters. A minimum and maximum value for each of R G B that, if provided, the plug would not alter any pixel who's R G or B value was outside of that range. In this way, the user could specify a color range that is to be amplified while all others colors remain unchanged. For example, a fairly noisy surveillance camera watching for something of a specific color, and this plug could be set to react to this color (plus-minus a range to compensate for camera color compression losses). Again, I am just future-thinking of maximum benefits for everyone.

I am so appreciative of you for creating this plug. I lack the programming skills to convert scripts into plugs (although learning it is on my to-do list) and you are doing this for free.
Forensic is offline   Reply With Quote
Old 19th July 2013, 15:32   #7  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Okey Dokey. I'll keep the 99 limit and implement rgb limiting. Will be implemented for both RGB32 and RGB24.
Incidentally for future reference, RT_RgbChanAve will be marginally faster than RT_RgbChanMedian for single pixel, same result.

This as you envisaged ?
Code:
Function RgbAmplifier (clip clip, int "Radius", float "Multiplier",int "Rmin",int "GMin",int "Bmin",int "RMax",int "GMax",int "BMax") {
    # Radius==1, switches OFF averaging, Radius==2 = Diameter of 3 frames
    myName="RgbAmplifier: "
    Radius=Default(Radius,2) Multiplier=Float(Default(Multiplier,2.0))
    RMin=Default(RMin,0) GMin=Default(GMin,0) BMin=Default(BMin,0) RMax=Default(RMax,255) GMax=Default(GMax,255) BMax=Default(BMax,255)
    Assert(Radius>=1 && Radius <= 99,"RgbAmplifier: Radius range 1->99 ("+String(Radius)+")")
    Assert(Multiplier>=0.0 && Multiplier<=10.0,"RgbAmplifier: 0.0 <= Multiplier <= 10.0  ("+String(Multiplier)+")")
    Assert(RMin<=255&&RMin>=0,myName+"RMin range 0 -> 255 ("+String(RMin)+")")
    Assert(GMin<=255&&GMin>=0,myName+"GMin range 0 -> 255 ("+String(GMin)+")")
    Assert(BMin<=255&&BMin>=0,myName+"BMin range 0 -> 255 ("+String(BMin)+")")
    Assert(RMax<=255&&RMax>=RMin,myName+"RMax range RMin -> 255 ("+String(RMax)+")")
    Assert(GMax<=255&&GMax>=GMin,myName+"GMax range GMin -> 255 ("+String(GMax)+")")
    Assert(BMax<=255&&BMax>=BMin,myName+"BMax range BMin -> 255 ("+String(BMax)+")")
    GScript("""
        WW=clip.Width() HH=clip.Height() FC=clip.Framecount()
        clipfinal=0
        for(i=0,FC-1) {
#           RT_Debug("Frame="+String(i))
            clip2=clip.trim(i,-1)
            rangemin = Max(i-(Radius-1),0)
            rangemax = Min(i+(Radius-1),FC-1)
            diameter = rangemax - rangemin + 1
            for(y=0,HH-1) {
                for(x=0,WW-1) {
                    red=0       green=0     blue=0
                    redavg=0    greenavg=0  blueavg=0
                    for(j=rangemin,rangemax){
                        col = clip.RT_RGB32AsInt(n=j, x=x, y=y)
                        b=RT_BitAND(col,$FF)    col=RT_BitLSR(col,8)
                        g=RT_BitAND(col,$FF)    col=RT_BitLSR(col,8)
                        r=RT_BitAND(col,$FF)
                        redavg      = redavg    + r
                        greenavg    = greenavg  + g
                        blueavg     = blueavg   + b
                        if(j==i) {
                            red     =   r
                            green   =   g
                            blue    =   b
                        }
                    }
                    if(r>=RMin&&r<=RMax && g>=GMin&&g<=GMax && b>=BMin&&b<=BMax) {
                        redavg = Float(redavg) / diameter
                        newred = Round(redavg + (Multiplier * ( red - redavg)))
                        newred = Max(Min(newred,255),0)
                        ###
                        greenavg = Float(greenavg) / diameter
						newgreen = Round(greenavg + (Multiplier * ( green - greenavg)))
                        newgreen = Max(Min(newgreen,255),0)
                        ###
                        blueavg = Float(blueavg) / diameter
						newblue = Round(blueavg + (Multiplier * ( blue - blueavg)))
                        newblue = Max(Min(newblue,255),0)
                        ###
                        clip2=clip2.Layer(clip2.BlankClip(pixel_type="RGB32", color=(newred*256+newgreen)*256+newblue)
                            \ .crop(0,0,1,1), x=x, y=y, level=257)
                    }
                }
            }
            clipfinal=(clipfinal.IsClip()) ? clipfinal++clip2 : clip2
        }
        return clipfinal
    """)
}

Avisource("D:\avs\test.avi").ConvertToRGB32()
trim(1000,-20)
crop(32,32,32,32)
A=RgbAmplifier(2,2.0)
StackHorizontal(A)
EDIT: Fixed color shift, convert to Gavino mod.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 24th July 2013 at 12:46.
StainlessS is offline   Reply With Quote
Old 20th July 2013, 16:02   #8  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Forensic, here you go.
LINK REMOVED, See first post

Code:
RGB24 and RGB32.

RgbAmplifier(clip clip,int "Radius"=1,float "Multiplier"=2.0,int "Rmin"=0,int "GMin"=0,int "Bmin"=0,int "RMax"=255,int "GMax"=255,int "BMax"=255)
Perhaps you'de like to donate some documentation.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 24th July 2013 at 13:02.
StainlessS is offline   Reply With Quote
Old 20th July 2013, 18:51   #9  |  Link
Forensic
Registered User
 
Join Date: Apr 2008
Location: California, USA
Posts: 127
Holy $#%@. It doesn't hog memory and even more amazing, literally a million times faster. I will create some documentation, but give me a week to play with it (in between my normal workload). Thank you for doing this. Should all of this move to its own discussion since it is its own plug and not part of RT_Stats, or should this simply become a new RT_Stats call?
Forensic is offline   Reply With Quote
Old 20th July 2013, 19:59   #10  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
When and if you do a little doc, I shall create a new thread for it.
Not really suited to the RT suite, even though there are a few standard filters in RT, they are usually
of use in the RT environment, RgbAmplifier() would need to read up to 197 frames for each frame
during ScriptClip() and so not really of use there (although I guess it could be used in script before
Scriptclip). anyway, think better to keep this one separate.

EDIT: I prefer to limit number of standard filters in RT, eg RT_Subtitle really has to be a standard filter
but is probably of most use within Scriptclip during runtime.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 20th July 2013 at 20:11. Reason: correction
StainlessS is offline   Reply With Quote
Old 21st July 2013, 00:35   #11  |  Link
Forensic
Registered User
 
Join Date: Apr 2008
Location: California, USA
Posts: 127
My script amplifies a scene to emphasize hard to detect changes in color or motion of faint objects captured by a fixed camera. Thanks to Gavino and especially StainlessS, this is now a very usable and powerful plug. Here it amplifies the otherwise nearly invisible shadows of two birds (loops several times), even though this was a very low quality and noisy original. It did the same thing for suspects hiding in the bushes for one of my active cases. The script/plug also does something pleasantly unexpected, it sharpens the details of all moving objects. Be aware that the plug adds a pseudo ghosting/transparency effect to those moving objects. This was expected and is unavoidable, but then again this plug is really intended for forensic purposes.

Last edited by Forensic; 21st July 2013 at 02:35. Reason: corrected URL
Forensic is offline   Reply With Quote
Old 21st July 2013, 04:34   #12  |  Link
Forensic
Registered User
 
Join Date: Apr 2008
Location: California, USA
Posts: 127
Usage documentation

RgbAmplifier
========================================
An Avisynth script to amplify color shifts

Given a clip, this filter examines every pixel of every frame and independently multiplies the difference of its specific R, G and B values from the average R, G and B values of that same pixel location spanning a defined radius of adjacent frames. If the new values are above or below the allowed RGB values, they are capped at those limits. The revised RGB values replace the original values, and the amplified clip is returned. If the Multiplier is set to a value of zero, the plugin acts as a temporal frame averager.

This plugin will:
Convert seemingly imperceptible color changes into obvious color changes
Highlight seemingly imperceptible movements of high contrast pixels
Sharpen the details of moving objects
Cause distortion or ghosting/transparency effect to moving objects (an unavoidable side effect)

This plugin requires RGB24 or RGB32 color space, and is intended for forensic analysis of videos created from fixed position cameras. Usage on non-stationary cameras may produce unpredictable or content destructive results. The faster the object and/or the greater the radius, the greater the risk of negatively impacting the visual accuracy of the moving object.

=====
Usage
RgbAmplifier(clip clip,int "Radius"=1,float "Multiplier"=2.0,int "Rmin"=0,int "GMin"=0,int "Bmin"=0,int "RMax"=255,int "GMax"=255,int "BMax"=255)


=====
Parameters:
Radius: integer from 1 to 99 (default 1). Defines the radius of how many frames are to be averaged (2 * radius -1). For example, a radius of 7 will instruct the filter to average 13 frames (2 * 7 -1). A value of 1 effectively disables the function (useful if adjusting the values within AVSpmod).

Multiplier: float from >=0.0 to <10 (default 2). Defines the multiplier for the difference between a pixel’s color value (for each of R, G and B values) and its average value (as defined by the Radius). For example, the default value of 2 will replace every R, G and B value of every pixel with a value twice as far from the average R, G or B value of that pixel.

Rmin: integer from 0 to 255 (default 0). Cannot be greater than Rmax. The filter will not alter any pixel whose Red color value is below this threshold value.

Gmin: integer from 0 to 255 (default 0). Cannot be greater than Gmax. The filter will not alter any pixel whose Green color value is below this threshold value.

Bmin: integer from 0 to 255 (default 0). Cannot be greater than Bmax. The filter will not alter any pixel whose Blue color value is below this threshold value.

Rmax: integer from 0 to 255 (default 255). Cannot be less than Rmin. The filter will not alter any pixel whose Red color value is above this threshold value.

Gmax: integer from 0 to 255 (default 255). Cannot be less than Gmin. The filter will not alter any pixel whose Ged color value is above this threshold value.

Bmax: integer from 0 to 255 (default 255). Cannot be less than Bmin. The filter will not alter any pixel whose Blue color value is above this threshold value.


=====
Examples:

Double pixel color deviations from the average of the current, preceding and postceding frame’s pixel value
RgbAmplifier ()


Temporal averaging using the current frame and the first four (Radius - 1) preceding and postceding frame’s pixel values
RgbAmplifier (Radius=5, Multiplier=1)


Triple pixel color deviations from the average of the current frame and the first two preceding and postceding frame’s pixel values, but only for pixels with a color within 2% of pure Cyan (“00AEEF”)
RgbAmplifier (Radius=2, Multiplier=3, Rmin=0, GMin=169, Bmin=234, RMax=5, GMax=179, BMax=244)


#########################################
Forensic

Last edited by Forensic; 24th July 2013 at 08:40. Reason: From other thread
Forensic is offline   Reply With Quote
Old 21st July 2013, 09:15   #13  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by Forensic View Post
If the Multiplier is set to a value of 1, the plugin acts as a temporal frame averager.
Is this right?
Unless 1 is treated as a special case, this is inconsistent with the prototype where
newred=red+magnifier*(red-redavg), etc.
A multiplier of -1 would give the average, but this isn't allowed.

Actually, I wonder if newred=redavg+magnifier*(red-redavg) would be a more intuitive definition. Then a zero multiplier would give the average, a value of 1 would leave pixels unchanged, and greater values would increase the contrast.

Quote:
Radius: integer from 1 to 99 (default 1). Defines the radius of how many frames are to be averaged (2 * radius +1). For example, a radius of 7 will instruct the filter to average 15 frames (2 * 7 +1).
In StainlessS's prototype, no of frames was 2*radius-1 (and radius 1 suppressed averaging). Has this changed?
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 21st July 2013, 11:07   #14  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Gavino is I think correct, awaiting new orders! (implemented as for prototype)

Diameter is (radius-1) + (radius+1) + 1, eg Radius==99 = 197 frame diameter (or 2*radius-1, as per G quote).

Perhaps a moderator could move ALL posts from 1st link above to this thread, thank you.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 22nd November 2022 at 15:03.
StainlessS is offline   Reply With Quote
Old 21st July 2013, 16:23   #15  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
Quote:
Perhaps a moderator could move ALL posts from 1st link above to this thread, thank you.
Which posts (numbers) do you want to see moved to this thread?
Wilbert is offline   Reply With Quote
Old 21st July 2013, 16:25   #16  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
All posts from linked post #148 through to #162, ie 148 onwards to current end. Thanx Wilbert.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 21st July 2013 at 16:28.
StainlessS is offline   Reply With Quote
Old 21st July 2013, 19:51   #17  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
Done. Note they are inserted in chronological order, so let me know if I need to delete Forensic's post so yours will be the first.

Last edited by Wilbert; 21st July 2013 at 19:53.
Wilbert is offline   Reply With Quote
Old 22nd July 2013, 17:50   #18  |  Link
Forensic
Registered User
 
Join Date: Apr 2008
Location: California, USA
Posts: 127
You are right

Quote:
Originally Posted by Gavino View Post
Is this right?
Unless 1 is treated as a special case, this is inconsistent with the prototype where
newred=red+magnifier*(red-redavg), etc.
A multiplier of -1 would give the average, but this isn't allowed.

Actually, I wonder if newred=redavg+magnifier*(red-redavg) would be a more intuitive definition. Then a zero multiplier would give the average, a value of 1 would leave pixels unchanged, and greater values would increase the contrast.


In StainlessS's prototype, no of frames was 2*radius-1 (and radius 1 suppressed averaging). Has this changed?
----------------

You are right. I have corrected the documentation. Should I post the corrected version into the new discussion thread -or- pack it into the DLL zip of StainlessS and upload it to MediaFire -or- do both?

Also, StainlessS would you first be willing to change to Gavino's version?
newred=redavg+magnifier*(red-redavg)
and allow the multiplier to be >=0 rather than >0

That would add a Frame Averaging option to the plug.
Forensic is offline   Reply With Quote
Old 22nd July 2013, 20:30   #19  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Forensic, yes, Absolutely, does not it make you sick how he is always right.
Will sort it out, dont hold your breath.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by Guest; 23rd July 2013 at 01:22. Reason: rule 4
StainlessS is offline   Reply With Quote
Old 22nd July 2013, 21:26   #20  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Problem I was having was the two (versions ie yours and the big G) gave differing results, ie they should give
same results with M-1.0 args, I was not getting that, think I have sorted the diff (down to precision stuff), and
should put up source giving identical results (+- 1.0 multipier) arg soon).

EDIT: the fast versions (PM) were giving identical results but floating point were not.

EDIT: Differing results were due to a real stupid mistake, I could not see the wood for the trees.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 9th August 2013 at 04:18.
StainlessS 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 18:10.


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