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

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

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

Video.getCurrentFrameIndex介绍

[英]Get the index of the current frame
[中]获取当前帧的索引

代码示例

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

  1. /**
  2. * Returns the position of the play head in this video as a percentage of
  3. * the length of the video. IF the video is a live video, this method will
  4. * always return 0;
  5. *
  6. * @return The percentage through the video.
  7. */
  8. public double getPosition() {
  9. final long nFrames = this.video.countFrames();
  10. if (nFrames == -1)
  11. return 0;
  12. return this.video.getCurrentFrameIndex() * 100d / nFrames;
  13. }

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

  1. /**
  2. * Returns the position of the play head in this video as a percentage of
  3. * the length of the video. IF the video is a live video, this method will
  4. * always return 0;
  5. *
  6. * @return The percentage through the video.
  7. */
  8. public double getPosition() {
  9. final long nFrames = this.video.countFrames();
  10. if (nFrames == -1)
  11. return 0;
  12. return this.video.getCurrentFrameIndex() * 100d / nFrames;
  13. }

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

  1. @Override
  2. public List<Identifiable> getIdentifiers()
  3. {
  4. final List<Identifiable> r =
  5. new ArrayList<Identifiable>();
  6. r.add(new IdentifiableVideoFrame(video.getCurrentFrame(),
  7. new HrsMinSecFrameTimecode(video.getCurrentFrameIndex(),
  8. video.getFPS())));
  9. return r;
  10. }
  11. }, sp);

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

  1. @Override
  2. public List<Identifiable> getIdentifiers()
  3. {
  4. final List<Identifiable> r =
  5. new ArrayList<Identifiable>();
  6. r.add(new IdentifiableVideoFrame(video.getCurrentFrame(),
  7. new HrsMinSecFrameTimecode(video.getCurrentFrameIndex(),
  8. video.getFPS())));
  9. return r;
  10. }
  11. }, sp);

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

  1. /**
  2. * Process the video and provide a URI which all relations will be linked to.
  3. *
  4. * @param v The video to process
  5. * @param uri The URI of the video
  6. */
  7. public void processVideo( final Video<MBFImage> v, final String uri )
  8. {
  9. this.videoURI = uri;
  10. for (final MBFImage frame : v)
  11. this.processFrame( frame,
  12. new HrsMinSecFrameTimecode( v.getCurrentFrameIndex(), v.getFPS() ) );
  13. }

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

  1. /**
  2. * Process the video and provide a URI which all relations will be linked to.
  3. *
  4. * @param v The video to process
  5. * @param uri The URI of the video
  6. */
  7. public void processVideo( final Video<MBFImage> v, final String uri )
  8. {
  9. this.videoURI = uri;
  10. for (final MBFImage frame : v)
  11. this.processFrame( frame,
  12. new HrsMinSecFrameTimecode( v.getCurrentFrameIndex(), v.getFPS() ) );
  13. }

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

  1. /**
  2. * Force the given identifiable to be updated in the dataset for the current
  3. * time.
  4. *
  5. * @param i
  6. * The identifiable
  7. */
  8. public void updateIdentifiable(final Identifiable i)
  9. {
  10. final List<String> tags = this.stateProvider.getCurrentState(i);
  11. if (tags == null)
  12. return;
  13. final AnnotatedIdentifiable ai = new AnnotatedIdentifiable();
  14. ai.id = i;
  15. ai.startTimestamp = new HrsMinSecFrameTimecode(
  16. this.video.getCurrentFrameIndex(), this.video.getFPS());
  17. ai.tags = new ArrayList<String>(tags);
  18. this.addToDataset(ai);
  19. }

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

  1. /**
  2. * Force the given identifiable to be updated in the dataset for the current
  3. * time.
  4. *
  5. * @param i
  6. * The identifiable
  7. */
  8. public void updateIdentifiable(final Identifiable i)
  9. {
  10. final List<String> tags = this.stateProvider.getCurrentState(i);
  11. if (tags == null)
  12. return;
  13. final AnnotatedIdentifiable ai = new AnnotatedIdentifiable();
  14. ai.id = i;
  15. ai.startTimestamp = new HrsMinSecFrameTimecode(
  16. this.video.getCurrentFrameIndex(), this.video.getFPS());
  17. ai.tags = new ArrayList<String>(tags);
  18. this.addToDataset(ai);
  19. }

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

  1. video.getCurrentFrameIndex() - 1, video.getFPS());
  2. video.getCurrentFrameIndex() - 1, video.getFPS());

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

  1. video.getCurrentFrameIndex() - 1, video.getFPS());
  2. video.getCurrentFrameIndex() - 1, video.getFPS());

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

  1. this.video.getCurrentFrameIndex(), this.video.getFPS());

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

  1. this.video.getCurrentFrameIndex(), this.video.getFPS());

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

  1. /**
  2. * Cache the given time range from the given video.
  3. *
  4. * @param <I> The type of the video frames
  5. * @param video The video to cache
  6. * @param start The start of the video to cache
  7. * @param end The end of the video to cache
  8. * @return A {@link VideoCache}
  9. */
  10. public static <I extends Image<?,I>> VideoCache<I> cacheVideo( Video<I> video,
  11. VideoTimecode start, VideoTimecode end )
  12. {
  13. VideoCache<I> vc = new VideoCache<I>( video.getWidth(),
  14. video.getHeight(), video.getFPS() );
  15. video.setCurrentFrameIndex( start.getFrameNumber() );
  16. while( video.hasNextFrame() &&
  17. video.getCurrentFrameIndex() < end.getFrameNumber() )
  18. vc.addFrame( video.getNextFrame().clone() );
  19. return vc;
  20. }
  21. }

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

  1. /**
  2. * Cache the given time range from the given video.
  3. *
  4. * @param <I> The type of the video frames
  5. * @param video The video to cache
  6. * @param start The start of the video to cache
  7. * @param end The end of the video to cache
  8. * @return A {@link VideoCache}
  9. */
  10. public static <I extends Image<?,I>> VideoCache<I> cacheVideo( Video<I> video,
  11. VideoTimecode start, VideoTimecode end )
  12. {
  13. VideoCache<I> vc = new VideoCache<I>( video.getWidth(),
  14. video.getHeight(), video.getFPS() );
  15. video.setCurrentFrameIndex( start.getFrameNumber() );
  16. while( video.hasNextFrame() &&
  17. video.getCurrentFrameIndex() < end.getFrameNumber() )
  18. vc.addFrame( video.getNextFrame().clone() );
  19. return vc;
  20. }
  21. }

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

  1. FeatureTable trackFeatures(Video<FImage> video, int nFeatures, boolean replace) {
  2. final TrackingContext tc = new TrackingContext();
  3. final FeatureList fl = new FeatureList(nFeatures);
  4. final FeatureTable ft = new FeatureTable(nFeatures);
  5. final KLTTracker tracker = new KLTTracker(tc, fl);
  6. tc.setSequentialMode(true);
  7. tc.setWriteInternalImages(false);
  8. tc.setAffineConsistencyCheck(-1);
  9. FImage prev = video.getCurrentFrame();
  10. tracker.selectGoodFeatures(prev);
  11. ft.storeFeatureList(fl, 0);
  12. while (video.hasNextFrame()) {
  13. final FImage next = video.getNextFrame();
  14. tracker.trackFeatures(prev, next);
  15. if (replace)
  16. tracker.replaceLostFeatures(next);
  17. prev = next;
  18. ft.storeFeatureList(fl, video.getCurrentFrameIndex());
  19. }
  20. return ft;
  21. }

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

  1. FeatureTable trackFeatures(Video<FImage> video, int nFeatures, boolean replace) {
  2. final TrackingContext tc = new TrackingContext();
  3. final FeatureList fl = new FeatureList(nFeatures);
  4. final FeatureTable ft = new FeatureTable(nFeatures);
  5. final KLTTracker tracker = new KLTTracker(tc, fl);
  6. tc.setSequentialMode(true);
  7. tc.setWriteInternalImages(false);
  8. tc.setAffineConsistencyCheck(-1);
  9. FImage prev = video.getCurrentFrame();
  10. tracker.selectGoodFeatures(prev);
  11. ft.storeFeatureList(fl, 0);
  12. while (video.hasNextFrame()) {
  13. final FImage next = video.getNextFrame();
  14. tracker.trackFeatures(prev, next);
  15. if (replace)
  16. tracker.replaceLostFeatures(next);
  17. prev = next;
  18. ft.storeFeatureList(fl, video.getCurrentFrameIndex());
  19. }
  20. return ft;
  21. }

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

  1. endTime.setFrameNumber( video.getCurrentFrameIndex() );

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

  1. endTime.setFrameNumber( video.getCurrentFrameIndex() );

相关文章