org.openimaj.video.Video.setCurrentFrameIndex()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(363)

本文整理了Java中org.openimaj.video.Video.setCurrentFrameIndex()方法的一些代码示例,展示了Video.setCurrentFrameIndex()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Video.setCurrentFrameIndex()方法的具体详情如下:
包路径:org.openimaj.video.Video
类名称:Video
方法名:setCurrentFrameIndex

Video.setCurrentFrameIndex介绍

[英]Set the current frame index (i.e. skips to a certain frame). If your video subclass can implement this in a cleverer way, then override this method, otherwise this method will simply grab frames until it gets to the given frame index. This method is naive and may take some time as each frame will be decoded by the video decoder.
[中]设置当前帧索引(即跳到特定帧)。如果你的视频子类能以一种更聪明的方式实现这一点,那么就重写这个方法,否则这个方法只会抓取帧,直到它到达给定的帧索引。这种方法很简单,可能需要一些时间,因为视频解码器将对每个帧进行解码。

代码示例

代码示例来源:origin: openimaj/openimaj

/**
   *     Cache the given time range from the given video.
   * 
   *    @param <I> The type of the video frames
   *    @param video The video to cache
   *    @param start The start of the video to cache
   *    @param end The end of the video to cache
   *    @return A {@link VideoCache}
   */
  public static <I extends Image<?,I>> VideoCache<I> cacheVideo( Video<I> video,
      VideoTimecode start, VideoTimecode end )
  {
    VideoCache<I> vc = new VideoCache<I>( video.getWidth(), 
        video.getHeight(), video.getFPS() );
    video.setCurrentFrameIndex( start.getFrameNumber() );
    while( video.hasNextFrame() && 
        video.getCurrentFrameIndex() < end.getFrameNumber() )
      vc.addFrame( video.getNextFrame().clone() );
    return vc;
  }
}

代码示例来源:origin: org.openimaj/core-video

/**
   *     Cache the given time range from the given video.
   * 
   *    @param <I> The type of the video frames
   *    @param video The video to cache
   *    @param start The start of the video to cache
   *    @param end The end of the video to cache
   *    @return A {@link VideoCache}
   */
  public static <I extends Image<?,I>> VideoCache<I> cacheVideo( Video<I> video,
      VideoTimecode start, VideoTimecode end )
  {
    VideoCache<I> vc = new VideoCache<I>( video.getWidth(), 
        video.getHeight(), video.getFPS() );
    video.setCurrentFrameIndex( start.getFrameNumber() );
    while( video.hasNextFrame() && 
        video.getCurrentFrameIndex() < end.getFrameNumber() )
      vc.addFrame( video.getNextFrame().clone() );
    return vc;
  }
}

代码示例来源:origin: openimaj/openimaj

video.setCurrentFrameIndex( keyframeTime.getFrameNumber() );
MBFImage image = video.getCurrentFrame();

代码示例来源:origin: org.openimaj/sandbox

video.setCurrentFrameIndex( keyframeTime.getFrameNumber() );
MBFImage image = video.getCurrentFrame();

代码示例来源:origin: openimaj/openimaj

video.setCurrentFrameIndex( startTime.getFrameNumber() );
I image = video.getCurrentFrame();
I keyframeImage = image.clone();

代码示例来源:origin: org.openimaj/video-processing

video.setCurrentFrameIndex( startTime.getFrameNumber() );
I image = video.getCurrentFrame();
I keyframeImage = image.clone();

相关文章