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

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

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

Video.getFPS介绍

[英]Get the frame rate
[中]获取帧速率

代码示例

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

@Override
public double getFPS()
{
  return video.getFPS();
}

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

/**
 * {@inheritDoc}
 *
 * @see org.openimaj.video.Video#getFPS()
 */
@Override
public double getFPS()
{
  return this.video.getFPS();
}

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

@Override
public double getFPS()
{
  return video.getFPS();
}

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

/**
 * {@inheritDoc}
 *
 * @see org.openimaj.vis.timeline.TimelineObjectAdapter#getEndTimeMilliseconds()
 */
@Override
public long getEndTimeMilliseconds() {
  return this.startTime + (long) (this.nFrames / this.data.getFPS() * 1000);
}

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

/**
 * {@inheritDoc}
 *
 * @see org.openimaj.video.Video#getFPS()
 */
@Override
public double getFPS()
{
  return this.video.getFPS();
}

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

/**
 * Returns the position of the given frame at the scale of the current
 * display. The position is given in pixel from the start of the bar.
 *
 * @param nFrame
 *            The frame index
 * @return The position in pixels of the frame.
 */
protected double getTimePosition(final int nFrame)
{
  return this.pixelTransformer.calculatePosition(
      new double[] { nFrame*1000/this.data.getFPS(), 0 } )[0];
}

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

@Override
public ImageCollectionEntry<T> next() {
  final T image = video.getNextFrame();
  final ImageCollectionEntry<T> entry = new ImageCollectionEntry<T>();
  entry.meta = new HashMap<String, String>();
  entry.meta.put("timestamp", "" + this.frameCount / this.video.getFPS());
  entry.accepted = selection.acceptEntry(image);
  entry.image = image;
  this.frameCount++;
  // hack to stop the iterator at the end until hasNext works properly
  if (image == null)
    frameCount = -1;
  return entry;
}

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

/**
   *     Default constructor
   *     @param v The video to track faces in
   *    @throws IOException
   */
  public VideoFaceTracker( final Video<MBFImage> v ) throws IOException
  {
    final VideoDisplay<MBFImage> vd = VideoDisplay.createVideoDisplay( v );
    vd.addVideoListener( this );
    this.shotDetector = new HistogramVideoShotDetector( v.getFPS() );
//        shotDetector.setThreshold( 500 );
  }

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

/**
   *     Default constructor
   *     @param v The video to track faces in
   *    @throws IOException
   */
  public VideoFaceTracker( final Video<MBFImage> v ) throws IOException
  {
    final VideoDisplay<MBFImage> vd = VideoDisplay.createVideoDisplay( v );
    vd.addVideoListener( this );
    this.shotDetector = new HistogramVideoShotDetector( v.getFPS() );
//        shotDetector.setThreshold( 500 );
  }

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

@Override
  public List<Identifiable> getIdentifiers()
  {
    final List<Identifiable> r =
        new ArrayList<Identifiable>();
    r.add(new IdentifiableVideoFrame(video.getCurrentFrame(),
        new HrsMinSecFrameTimecode(video.getCurrentFrameIndex(),
            video.getFPS())));
    return r;
  }
}, sp);

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

@Override
  public List<Identifiable> getIdentifiers()
  {
    final List<Identifiable> r =
        new ArrayList<Identifiable>();
    r.add(new IdentifiableVideoFrame(video.getCurrentFrame(),
        new HrsMinSecFrameTimecode(video.getCurrentFrameIndex(),
            video.getFPS())));
    return r;
  }
}, sp);

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

/**
 * Process the video and provide a URI which all relations will be linked to.
 *
 * @param v The video to process
 * @param uri The URI of the video
 */
public void processVideo( final Video<MBFImage> v, final String uri )
{
  this.videoURI = uri;
  for (final MBFImage frame : v)
    this.processFrame( frame,
      new HrsMinSecFrameTimecode( v.getCurrentFrameIndex(), v.getFPS() ) );
}

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

/**
 * Process the video and provide a URI which all relations will be linked to.
 *
 * @param v The video to process
 * @param uri The URI of the video
 */
public void processVideo( final Video<MBFImage> v, final String uri )
{
  this.videoURI = uri;
  for (final MBFImage frame : v)
    this.processFrame( frame,
      new HrsMinSecFrameTimecode( v.getCurrentFrameIndex(), v.getFPS() ) );
}

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

/**
 * Force the given identifiable to be updated in the dataset for the current
 * time.
 * 
 * @param i
 *            The identifiable
 */
public void updateIdentifiable(final Identifiable i)
{
  final List<String> tags = this.stateProvider.getCurrentState(i);
  if (tags == null)
    return;
  final AnnotatedIdentifiable ai = new AnnotatedIdentifiable();
  ai.id = i;
  ai.startTimestamp = new HrsMinSecFrameTimecode(
      this.video.getCurrentFrameIndex(), this.video.getFPS());
  ai.tags = new ArrayList<String>(tags);
  this.addToDataset(ai);
}

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

/**
   * @param args
   *            Command-line args
   * @throws VideoCaptureException
   */
  public static void main(final String[] args) throws VideoCaptureException
  {
    final PersonLinkerOptions o = PersonLinker.parseArgs(args);
    final PersonLinker pm = new PersonLinker(o);

    Video<MBFImage> video = null;
    if (o.inputFile != null)
      video = new XuggleVideo(o.inputFile);
    else
      video = new VideoCapture(320, 240);

    System.out.println("Processing video from " + (o.inputFile == null ? "webcam" : o.inputFile));
    pm.getShotDetector().setFPS(video.getFPS());
    pm.processVideo(video);

    System.out.println( pm.linkedRange );
  }
}

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

/**
 * Force the given identifiable to be updated in the dataset for the current
 * time.
 * 
 * @param i
 *            The identifiable
 */
public void updateIdentifiable(final Identifiable i)
{
  final List<String> tags = this.stateProvider.getCurrentState(i);
  if (tags == null)
    return;
  final AnnotatedIdentifiable ai = new AnnotatedIdentifiable();
  ai.id = i;
  ai.startTimestamp = new HrsMinSecFrameTimecode(
      this.video.getCurrentFrameIndex(), this.video.getFPS());
  ai.tags = new ArrayList<String>(tags);
  this.addToDataset(ai);
}

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

/**
   * @param args
   *            Command-line args
   * @throws VideoCaptureException
   */
  public static void main(final String[] args) throws VideoCaptureException
  {
    final PersonLinkerOptions o = PersonLinker.parseArgs(args);
    final PersonLinker pm = new PersonLinker(o);

    Video<MBFImage> video = null;
    if (o.inputFile != null)
      video = new XuggleVideo(o.inputFile);
    else
      video = new VideoCapture(320, 240);

    System.out.println("Processing video from " + (o.inputFile == null ? "webcam" : o.inputFile));
    pm.getShotDetector().setFPS(video.getFPS());
    pm.processVideo(video);

    System.out.println( pm.linkedRange );
  }
}

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

/**
 *     Cache the whole of the given video.
 *  @param <I> Type of {@link Image} 
 * 
 *    @param video The video to cache
 *    @return A {@link VideoCache}
 */
public static <I extends Image<?,I>> VideoCache<I> cacheVideo( Video<I> video )
{
  VideoCache<I> vc = new VideoCache<I>( video.getWidth(), 
      video.getHeight(), video.getFPS() );
  video.reset();
  while( video.hasNextFrame() )
    vc.addFrame( video.getNextFrame().clone() );
  return vc;
}

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

/**
 *     Cache the whole of the given video.
 *  @param <I> Type of {@link Image} 
 * 
 *    @param video The video to cache
 *    @return A {@link VideoCache}
 */
public static <I extends Image<?,I>> VideoCache<I> cacheVideo( Video<I> video )
{
  VideoCache<I> vc = new VideoCache<I>( video.getWidth(), 
      video.getHeight(), video.getFPS() );
  video.reset();
  while( video.hasNextFrame() )
    vc.addFrame( video.getNextFrame().clone() );
  return vc;
}

代码示例来源: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;
  }
}

相关文章