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

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

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

Video.countFrames介绍

[英]Return the number of frames in the whole video. If the video is a live stream, then this method should return -1.
[中]返回整个视频中的帧数。如果视频是实时流,那么这个方法应该返回-1。

代码示例

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

  1. @Override
  2. public long countFrames()
  3. {
  4. return video.countFrames();
  5. }

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

  1. @Override
  2. public long countFrames()
  3. {
  4. return video.countFrames();
  5. }

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

  1. /**
  2. * {@inheritDoc}
  3. *
  4. * @see org.openimaj.video.Video#hasNextFrame()
  5. */
  6. @Override
  7. public long countFrames()
  8. {
  9. if (this.video == null)
  10. throw new UnsupportedOperationException("Chain method called on non-chainable processor");
  11. return this.video.countFrames();
  12. }

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

  1. /**
  2. * {@inheritDoc}
  3. *
  4. * @see org.openimaj.video.Video#hasNextFrame()
  5. */
  6. @Override
  7. public long countFrames()
  8. {
  9. if (this.video == null)
  10. throw new UnsupportedOperationException("Chain method called on non-chainable processor");
  11. return this.video.countFrames();
  12. }

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

  1. /**
  2. * Change the video that is being displayed by this video display.
  3. *
  4. * @param newVideo
  5. * The new video to display.
  6. */
  7. public void changeVideo(final Video<T> newVideo) {
  8. this.video = newVideo;
  9. this.timeKeeper = new BasicVideoTimeKeeper(newVideo.countFrames() == -1);
  10. }

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

  1. /**
  2. * Change the video that is being displayed by this video display.
  3. *
  4. * @param newVideo
  5. * The new video to display.
  6. */
  7. public void changeVideo(final Video<T> newVideo) {
  8. this.video = newVideo;
  9. this.timeKeeper = new BasicVideoTimeKeeper(newVideo.countFrames() == -1);
  10. }

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

  1. /**
  2. *
  3. * @param data
  4. */
  5. protected VideoBarVisualisation(final Video<MBFImage> video) {
  6. this.data = video;
  7. this.nFrames = this.data.countFrames();
  8. this.setPreferredSize(new Dimension(1, 120 + (this.showAudio ? this.audioHeight : 0)));
  9. }

代码示例来源: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: openimaj/openimaj

  1. /**
  2. * Set the position of the play head to the given percentage. If the video
  3. * is a live video this method will have no effect.
  4. *
  5. * @param pc
  6. * The percentage to set the play head to.
  7. */
  8. public void setPosition(final double pc) {
  9. if (pc > 100 || pc < 0)
  10. throw new IllegalArgumentException("Percentage must be less than " +
  11. "or equals to 100 and greater than or equal 0. Given " + pc);
  12. // If it's a live video we cannot do anything
  13. if (this.video.countFrames() == -1)
  14. return;
  15. // We have to seek to a millisecond position, so we find out the length
  16. // of the video in ms and then multiply by the percentage
  17. final double nMillis = this.video.countFrames() * this.video.getFPS();
  18. final long msPos = (long) (nMillis * pc / 100d);
  19. System.out.println("msPOs = " + msPos + " (" + pc + "%)");
  20. this.seek(msPos);
  21. }

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

  1. /**
  2. * Set the position of the play head to the given percentage. If the video
  3. * is a live video this method will have no effect.
  4. *
  5. * @param pc
  6. * The percentage to set the play head to.
  7. */
  8. public void setPosition(final double pc) {
  9. if (pc > 100 || pc < 0)
  10. throw new IllegalArgumentException("Percentage must be less than " +
  11. "or equals to 100 and greater than or equal 0. Given " + pc);
  12. // If it's a live video we cannot do anything
  13. if (this.video.countFrames() == -1)
  14. return;
  15. // We have to seek to a millisecond position, so we find out the length
  16. // of the video in ms and then multiply by the percentage
  17. final double nMillis = this.video.countFrames() * this.video.getFPS();
  18. final long msPos = (long) (nMillis * pc / 100d);
  19. System.out.println("msPOs = " + msPos + " (" + pc + "%)");
  20. this.seek(msPos);
  21. }

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

  1. /**
  2. * Construct a video display with the given video and audio
  3. *
  4. * @param v
  5. * The video
  6. * @param a
  7. * The audio
  8. * @param screen
  9. * The frame to draw into.
  10. */
  11. public VideoDisplay(final Video<T> v, final AudioStream a, final ImageComponent screen) {
  12. this.video = v;
  13. // If we're given audio, we create an audio player that will also
  14. // act as our synchronisation time keeper.
  15. if (a != null) {
  16. this.audioPlayer = new AudioPlayer(a);
  17. this.timeKeeper = this.audioPlayer;
  18. }
  19. // If no audio is provided, we'll use a basic time keeper
  20. else
  21. this.timeKeeper = new BasicVideoTimeKeeper(this.video.countFrames() == -1);
  22. this.screen = screen;
  23. this.videoDisplayListeners = new ArrayList<VideoDisplayListener<T>>();
  24. this.stateListeners = new ArrayList<VideoDisplayStateListener>();
  25. this.positionListeners = new ArrayList<VideoPositionListener>();
  26. }

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

  1. /**
  2. * Construct a video display with the given video and audio
  3. *
  4. * @param v
  5. * The video
  6. * @param a
  7. * The audio
  8. * @param screen
  9. * The frame to draw into.
  10. */
  11. public VideoDisplay(final Video<T> v, final AudioStream a, final ImageComponent screen) {
  12. this.video = v;
  13. // If we're given audio, we create an audio player that will also
  14. // act as our synchronisation time keeper.
  15. if (a != null) {
  16. this.audioPlayer = new AudioPlayer(a);
  17. this.timeKeeper = this.audioPlayer;
  18. }
  19. // If no audio is provided, we'll use a basic time keeper
  20. else
  21. this.timeKeeper = new BasicVideoTimeKeeper(this.video.countFrames() == -1);
  22. this.screen = screen;
  23. this.videoDisplayListeners = new ArrayList<VideoDisplayListener<T>>();
  24. this.stateListeners = new ArrayList<VideoDisplayStateListener>();
  25. this.positionListeners = new ArrayList<VideoPositionListener>();
  26. }

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

  1. if (this.video.countFrames() != -1 && this.currentFrame != null) {
  2. final long t = this.timeKeeper.getTime().getTimecodeInMilliseconds();

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

  1. if (this.video.countFrames() != -1 && this.currentFrame != null) {
  2. final long t = this.timeKeeper.getTime().getTimecodeInMilliseconds();

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

  1. nFrames = video.countFrames();

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

  1. nFrames = video.countFrames();

相关文章