T - Type of Imagepublic abstract class VideoProcessor<T extends Image<?,T>> extends Video<T>
As a stand-alone processor it may be used as such:
MyVideoProcessor vp = new MyVideoProcessor();
vp.process( myVideo );
As a chainable processor it may be used as so:
MyVideoProcessor vp = new MyVideoProcessor( myVideo );
MyOtherProcessor op = new MyOtherProcessor( vp );
AnotherProcessor ap = new AnotherProcessor( op );
ap.process();
If any of the chain-based functions are called when the video has not been
set, an UnsupportedOperationException is thrown.
In the same way that ImageProcessors are expected to change the image
content, video processors should change the video frame content in place,
returning new altered frames. If you do not need to do this then use the
VideoAnalyser.
| Constructor and Description |
|---|
VideoProcessor()
Default constructor for using the video processor in an ad-hoc manner.
|
VideoProcessor(Video<T> v)
Constructor for creating a video processor which is chainable.
|
| Modifier and Type | Method and Description |
|---|---|
long |
countFrames()
Return the number of frames in the whole video.
|
T |
getCurrentFrame()
Get the current frame
|
double |
getFPS()
Get the frame rate
|
int |
getHeight()
Get the height of the video frame.
|
T |
getNextFrame()
Get the next frame.
|
long |
getTimeStamp()
Get the timestamp of the current frame in milliseconds
|
int |
getWidth()
Get the width of the video frame
|
boolean |
hasNextFrame()
Returns whether this video has another frame to provide.
|
void |
process()
This is a sugar function that will call
process(Video) with the
current video (for chainable processors). |
void |
process(Video<T> video)
Process the given video using this processor.
|
abstract T |
processFrame(T frame)
Process a frame in this video.
|
void |
processingComplete()
A hook for subclasses to be called when processing for the video has
completed to clean up after themselves.
|
void |
reset()
No implementation.
|
close, getCurrentFrameIndex, iterator, seek, setCurrentFrameIndexclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic VideoProcessor()
public VideoProcessor(Video<T> v)
v - The video to processpublic abstract T processFrame(T frame)
frame - The frame to process.public void processingComplete()
public void process(Video<T> video)
video - The video to process.public void process()
process(Video) with the
current video (for chainable processors).public int getWidth()
public int getHeight()
public T getNextFrame()
getNextFrame in class Video<T extends Image<?,T>>Video.getNextFrame()public boolean hasNextFrame()
hasNextFrame in class Video<T extends Image<?,T>>Video.hasNextFrame()public long countFrames()
countFrames in class Video<T extends Image<?,T>>Video.hasNextFrame()public T getCurrentFrame()
getCurrentFrame in class Video<T extends Image<?,T>>Video.getCurrentFrame()public void reset()
public long getTimeStamp()
getTimeStamp in class Video<T extends Image<?,T>>Video.getTimeStamp()