View Single Post
Old 24th September 2015, 01:06   #17  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Client

Code:
Import("SelectRanges.avs")
Import("LightningSelectFrames.avs")

###
#LightningSelectFrames_Client.avs      # Req:- GScript, Grunt, RT_Stats, FrameSel, Prune.
###
#VideoFilename = "Lightning.avi"
VideoFilename = "Join3.avi"

####
DB = VideoFilename + ".DB"

THRESH     = 5.0             # Lightning >= THRESH 
PARTFRAMES = 10              # Frames to keep either side of lightning sequences
                             # If Dark Seq length between L seqs is <= 2*PARTFRAMES then will be coalesced into L seq.
####
####
Avisource(VideoFilename,Audio=False)

#### InitDB() Must be called to create DB, and write AverageLuma to DBase for each frame.
####    InitDB() can optionally call SequenceDB (when Thresh>0.0) and also PartitionDB (when Thresh>0.0 and PARTFRAMES>0)
#### 
#### After DB created can call SequenceDB, PartitionDB{only after SequenceDB) and ShowDB as you wish
#### SequenceDB splits DB frames into sequences of light and Dark frames based on AverageLuma Thresh, can re-sequence without repeat call to InitDB.
#### PartitionDB, coalesces 'L' sequences. Can re-partition without repeat calls the InitDB and SequenceDB. 
#### 

DEBUG=False                             # In event of problems make True (Get DebugView https://technet.microsoft.com/en-us/library/bb896647.aspx)

# Comment out below 3 options when done (or repeat run will do them all again)
InitDB(Last,DB,Debug=DEBUG)             # After InitDB, can comment out and call PartitionDB to change PARTFRAMES
SequenceDB(DB,THRESH,Debug=DEBUG)       # Sequence if not already done by InitDB.
PartitionDB(DB,PARTFRAMES,Debug=DEBUG)  # Partition if not already done by InitDB.


#### ShowDB, shows metrics, can un-comment and use together with one of the Getxxx options to show metrics with selected frames.
ShowDB(Last,DB)                          # View DB Sequence and Partition status (MUST call at least InitDB before use)

#### Select frames to return, un-comment one only (after DB initialised and sequenced, and Partitioned).
#GetFlashFrames(Last,DB)                 # Get Brightest Flash from Each Seq
#GetSeqs(Last,DB)                        # Get Light Seqs
#GetSeqs(Last,DB,True)                   # Get DARK Seqs
#GetParts(Last,DB)                       # Get Light Partitions
#GetParts(Last,DB,True)                  # Get DARK Partitions
####
return Last
UPDATED
__________________
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; 1st October 2015 at 17:25. Reason: Update
StainlessS is offline   Reply With Quote