Log in

View Full Version : RgbAmplifier - Forensic Tool - v1.04 - 28 Nov 2018


Pages : [1] 2

StainlessS
15th July 2013, 21:45
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



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.

StainlessS
17th July 2013, 14:13
Below few posts moved from another thread.

Forensic, how bout this as template


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.

Forensic
18th July 2013, 08:05
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)



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)
""")
}

Gavino
18th July 2013, 09:27
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.

StainlessS
18th July 2013, 12:14
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.

Forensic
18th July 2013, 15:37
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.

StainlessS
19th July 2013, 15:32
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 ?

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.

StainlessS
20th July 2013, 16:02
Forensic, here you go.
LINK REMOVED, See first post


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.

Forensic
20th July 2013, 18:51
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?

StainlessS
20th July 2013, 19:59
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.

Forensic
21st July 2013, 00:35
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 (http://www.mediafire.com/watch/3o4z2hiictiqvj5/birds_amplified.flv) 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.

Forensic
21st July 2013, 04:34
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

Gavino
21st July 2013, 09:15
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.

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?

StainlessS
21st July 2013, 11:07
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.

Wilbert
21st July 2013, 16:23
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?

StainlessS
21st July 2013, 16:25
All posts from linked post #148 through to #162, ie 148 onwards to current end. Thanx Wilbert.

Wilbert
21st July 2013, 19:51
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.

Forensic
22nd July 2013, 17:50
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.

StainlessS
22nd July 2013, 20:30
Forensic, yes, Absolutely, does not it make you sick how he is always right.
Will sort it out, dont hold your breath.

StainlessS
22nd July 2013, 21:26
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.

Guest
23rd July 2013, 01:19
Why do we have two identically named threads about this? Which one should I close after linking to the other?

IanB
23rd July 2013, 07:11
Check with Wilbert, I believe he split post #148 through #162 off from the other thread, but post #148 was by Forensic and they wanted the thread owned by StainlessS. So post #148 (global post 1636945) became the owner of the other orphan thread and post #149 (global post 1636961) became the owner of this thread.

Perhaps you can remerge the 2 threads and "clone" an earlier dated post by StainlessS (eg global post 1636921 (http://forum.doom9.org/showthread.php?p=1636921#post1636921)) and press it into service as the owner for this thread.

StainlessS
23rd July 2013, 10:42
RgbAmplifier v1.01, with Gavino mod, see first post.

Guest
23rd July 2013, 12:23
Oy, I'll leave it to Wilbert then. Thanks.

Wilbert
23rd July 2013, 18:09
I'm a loss at what to do. Yes originally #148 was the first one of this thread. Since that post was not from StainlessS, i removed it from this thread (and moved the contents to the third post of this thread; #3). I thought that was sufficient. Perhaps Forensic didn't see that and moved it also to a new thread, so that's why there are two of them. So, tell me what i need to do ...

Guest
23rd July 2013, 20:11
I wouldn't try to tell you what to do, Wilbert! :)

I'll have a look and maybe make a suggestion. It just seems confusing to forum members to have the same thread title and same subject matter.

StainlessS
23rd July 2013, 21:15
I am well confused, Forensic, please delete your thread, thankyou.

Forensic
24th July 2013, 08:50
As requested, the other discussion has been deleted.

StainlessS, thank you for your work on this. When you post the new RgbAmplifier plug zip file (which I am very anxious to try) please include:

Gavino's [allow a zero multiplier]
Assert(Multiplier>=0.0 && Multiplier<10.0,"RgbAmplifier: 0.0 <= Multiplier < 10.0 ("+String(Multiplier)+")")

Gavino's [new color is added to the color avg value, not the color value]
newred = Round(redavg + (Multiplier * ( red - redavg)))
newgreen = Round(greenavg + (Multiplier * ( green - greenavg)))
newblue = Round(blueavg + (Multiplier * ( blue - blueavg)))

creaothceann's [corrected math, same as my original post]
color=(newred*256+newgreen)*256+newblue

Please include the above documentation in the text file.

StainlessS
24th July 2013, 12:32
@Forensic,
I refer the honourable gentleman to the post I made some moments ago:
[EDIT: Margaret Thatcher's favourite reply during PM's question time, with 'post' substituted for 'reply']

RgbAmplifier v1.01, with Gavino mod, see first post.

EDIT: Also, can you remove your dead link from this post:
http://forum.doom9.org/showthread.php?p=1637870#post1637870

EDIT: Perhaps you would also like to insert a link to this thread, into your currently last post in
RT_Stats thread, here: http://forum.doom9.org/showthread.php?p=1637744#post1637744

Forensic
24th July 2013, 17:21
@StainlessS
The dead link reference has been removed and my original RT_Stats comment now directs here. That should alleviate all the double post confusion.
Thank you for the new version. This plug has so much potential and is building excitement among my forensic colleagues.

StainlessS
24th July 2013, 21:38
Your Forensic colleagues seem to be an excitable bunch.

Forensic
24th July 2013, 22:15
We often get cases that haunt us for years after the enhancement is unsuccessful . Each tool allows us to revisit those cases. Besides, we love our profession.

StainlessS
24th July 2013, 22:23
Yes, but promise me something, you aint gonna nail me with my own "Stuff", give me a get out of jail free card, please.

StainlessS
24th July 2013, 22:28
I think from 5 upwards is considered serial killer, Let me have at least 4, so I know where to draw the line.

Forensic
24th July 2013, 23:38
I will promise you this: If a major case is solved using this tool, I will post about it here (as much as it can be talked about).

StainlessS
9th September 2013, 23:52
RgbAmplifier v1.02. see 1st post.

Sped up a little, especially if RMin/RMax etc at defaults (0,255).
Multiplier max now changed from 10.0 to 20.0.

Forensic
10th September 2013, 08:28
Thanks for the speed improvements. I will test it later this week.

StainlessS
7th June 2014, 19:33
New version, RgbAmplifier - Forensic Tool - v1.03 - 7 June 2014

Minor update. If called on same frame as previous call, then does not reset (ie does not newly re-read radius-1 frames either side of target frame).

Avoid possible cache bug here:- http://forum.doom9.org/showthread.php?p=1682827#post1682827
where would unnecessarily re-read up to 198 frames whenever a frame was requested more than once in succession.
Above noted bug would have no further effect on RGBAmplifier.

See 1st post.

Reel.Deel
10th December 2014, 02:38
Looking for something else I came across Forensic's webpage, pretty cool. :cool:
http://www.forensicprotection.com/RgbAmplifier.html

StainlessS
10th December 2014, 02:52
Yes RD, I came across that page + more about 6 months ago, I followed a few of his cases and such, with court verdicts and the like. Forensic is a minor celebrity it seems.

EDIT: Was wondering if he was OK as not been around for some time. Seems he was last active at some forensic shindig
in mid November 2014, so he is up and about. Am still though wondering what happened to Martin53, he went away on
safari and aint been heard of since (although, as well as 'safari' he also said I think 'going to the East' [in PM] so maybe India
or somewhere, not though heard the word 'safari' connected with India, usually Africa).

Reel.Deel
10th December 2014, 03:03
Just out of curiosity, for this method to work (RgbAmplifier) does it have to be RGB or can it be implemented for YUV also? Not requesting anything, just wondering.

StainlessS
10th December 2014, 03:15
Dont think it would yield anything useful (even at PC levels) in YUV. (Think there was mention of that early in thread)
See edit to prev post.

EDIT: I usually do implement for all colorspaces unless there is a reason not to, it aint usually that much extra bother
(EDIT: Unless non-full frame Interlaced PLANAR is involved, can be a lot of extra bother).

wonkey_monkey
20th December 2014, 21:09
I had no luck getting RgbAmplifier to work - it just ran out of memory - so I implemented my understanding of the process in a plugin:

http://forum.doom9.org/showthread.php?p=1703332#post1703332

Wilbert
20th December 2014, 23:12
I had no luck getting RgbAmplifier to work - it just ran out of memory - so I implemented my understanding of the process in a plugin:
Pity it is closed source again ;( Guess I have to implement it myself.

Do you think we will get 'better' results if do it in HSV space?

wonkey_monkey
20th December 2014, 23:25
Ah, well, for once I've written a plugin that doesn't rely on my convoluted image library, so sharing the source is easy - I've added it to the zip (http://horman.net/avisynth/amp.zip) file. I didn't put a licence in there but let's just agree it's GPLv2 :)

Apologies if the code is a bit in opaque in places - I tend to favour conciseness over clarity.

No idea what space would give best results - avoiding conversions seemed a good idea though.

David

StainlessS
20th December 2014, 23:33
David, can you please give spec on you system.
Already had probs reported on clipclop, perhaps related.
I may have given false info to reelreel, perhaps yuv was not so impossible,
Maybe I confused two diff plugs.
Anyways is a concern that you had OM probs, sounds very much like clipclop
Prob, perhaps a compiler thing, don't know.
Gonna have a few more seasonally approved beers and take another peek.
Dh, post your soure or at least pm to me, there should I hope have been no problem and is no problem on 32 bit m/c,s, I think.
Running out of battery, bye.

wonkey_monkey
20th December 2014, 23:59
On trying to load a script using RgbAmplifier, over the course of about 30 seconds VirtualDub's memory usage creeps up to 2Gb, then I get:

Avisynth open failure:
GetFrameBuffer: Returned a VFB with a 0 data pointer!
size=2073664, max=536870912, used=1067512512
I think we have run out of memory folks!
([GScript], line 15)
([GScript], line 27)
([GScript], line 42)
([GScript], line 43)
([GScript], line 45)

I copied and pasted the function from the 2nd post in this thread, and it was the first thing in my script, so those line numbers should correspond with line numbers in the function as posted.

The source was a 1920x1080 MTS, but the same thing happened with a half-sized Ut codec version, and also when I added another reduceby2 (making it 480x270).

I've added amp's source to the .zip file linked above.

RunniRunning out of battery, bye.

Aww. It's like Hal singing Daisy, Daisy at the end of 2001.

Reel.Deel
21st December 2014, 00:07
@davidhorman
Have you tried the current RgbAmplifier plugin (http://www.mediafire.com/download/432rxa9ed1lr2in/RgbAmplifier_25_dll_v1.03_20140607.zip)?

----

Edit:
@StainlessS
Is RgbAmplifier similar to "Eulerian Video Magnification (http://people.csail.mit.edu/mrub/vidmag/)"? Very interesting stuff, I found a web implementation here: https://github.com/antimatter15/evm

wonkey_monkey
21st December 2014, 00:48
Huh, I must have missed that one. It gives reassuringly identical results to mine, but is twice as fast. Mine works in YV12 and YUY2, though.

StainlessS
21st December 2014, 16:31
Oh thank goodness, I thought that you meant the plugin had Out Of Memory problems.
(The original script had OM problems due to OverLay which is very greedy on memory).


Is RgbAmplifier similar to Eulerian Video Magnification

A bit similar.
There is a page somewhere with quite a few before/after samples,
I hacked RgbAmplifier at one point to try to simulate same effect and to some degree it worked.
However the other thing requires completely still subject for it to work, contrary to RgbAmplifier which requires just fixed camera.
Eulerian Video Magnification worked better (at what it does) than the hacked version RgbAmp, but I was using their mp4 'before' samples which were probably somewhat more noisy than the actual source that they had available.
There were a number of exchanges between me and Forensic on that subject, but not sure if in RT_Stats or some other thread, or might even have been via PM.

(My PM box got full some months ago and so I wiped it).