Function:CuviVideoStabilizer

From CUVI Wiki
Jump to: navigation, search

CuviVideoStabilizer

A class to perform stabilization of a video file

  • CuviVideoStabilizer() - Default constructor. Creates empty CuviVideoStabilizer object.
  • CuviVideoStabilizer(const std::string& path, CuviMotionModel model = CUVI_MOTION_DEFAULT) - Creates a CuviVideoStabilizer object from the specified video file. Calls create.
  • ~CuviVideoStabilizer() - Destructor. Calls release.
  • CuviStatus create(const std::string& path, CuviMotionModel model = CUVI_MOTION_DEFAULT) - Creates a CuviVideoStabilizer object from the specified video file.
Name Type Description
path const std::string& Path of the input video file
model CuviMotionModel Type of motion to compensate.
  • void release(). Frees the CuviVideoStabilizer object.
  • CuviStatus getNextStabilizedFrame(CuviImage& stabilized) const; - Stabilize and return the next video frame.
Name Type Description
stabilized CuviImage& Output stabilized frame.
  • Cuvi32s width() const; - Returns width of the video frame.
  • Cuvi32s height() const; - Returns height of the video frame.
  • Cuvi32s numFrames() const; - Returns number of frames in the video.
  • Cuvi64f fps() const; - Returns frame rate of the video.

Image Type Support

Output
8uC3


Example

//Creating Video Stabilizer Object
CuviVideoStabilizer stabilizer(path);
 
CuviImage stabilized;
 
//Loop over all frames and visualize the stabilized video
for(int i=0; i<stab.numFrames(); i++)
{
    stabilizer.getNextStabilizedFrame(stabilized);
 
    cuvi::showImage("Stabilized Video", stabilized);
    cuvi::waitKeyPress(10);
}