Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

最后得到的阶段持续时间为负数,视频切割的最后几张图片的时间戳为0.0 #167

Closed
DoReMi115 opened this issue Dec 6, 2021 · 7 comments
Labels
bug Something isn't working not very important

Comments

@DoReMi115
Copy link

image
image

@DoReMi115
Copy link
Author

# 将视频切分成帧
def handle_video(file_name):
    video = VideoObject(file_name, pre_load=True)
    # 新建帧,计算视频总共有多少帧,每帧多少ms
    video.load_frames()
    # 压缩视频
    cutter = VideoCutter()
    # 指定的区域会被屏蔽掉
    hook = IgnoreHook(
        # 默认情况下,所有的坐标都是从左上角开始的
        # 如果我们需要偏移到右下角,意味着我们需要向下偏移 0.5 * height,向右偏移 0.5 * width
        # Hook采用两个参数size与offset,分别对应裁剪区域大小与偏移量
        # size=(0.01, 10),
        # offset=(0.1, 0.1),
        # 例如你希望屏蔽掉高度100宽度200的区域,则:
        size=(10, 200),
        offset=(1, 10),
        overwrite=True,
    )
    cutter.add_hook(hook)
    # hook_save_frame = FrameSaveHook('./picture/6_frame_save_dir')
    # cutter.add_hook(hook_save_frame)
    # 计算每一帧视频的每一个block的ssim和psnr。
    res = cutter.cut(video, block=6)
    # 计算出判断A帧到B帧之间是稳定还是不稳定
    stable, unstable = res.get_range(threshold=0.97, offset=3)
    # 把分好类的稳定阶段的图片存本地
    res.pick_and_save(stable, 20, to_dir='./picture/stable_frame', meaningful_name=True)
    return stable

@williamfzc
Copy link
Owner

应该是视频的问题,方便的话发一下视频看看

@DoReMi115
Copy link
Author

应该是视频的问题,方便的话发一下视频看看

  • 已发送邮件~ 谢谢

@williamfzc
Copy link
Owner

williamfzc commented Dec 6, 2021

opencv 什么版本?我这边没有问题哦
image

@DoReMi115
Copy link
Author

image
看了看都是最新版

@williamfzc williamfzc added the bug Something isn't working label Dec 7, 2021
@williamfzc
Copy link
Owner

williamfzc commented Dec 7, 2021

可以将这两个包降到 4.4.0.46 看看是否复现
我这边现象是在4.5+出现跟你一样的情况,4.4-不出现,可能是cv改了API

4.5 还不是个稳定版本,最好不要用

@DoReMi115
Copy link
Author

DoReMi115 commented Dec 7, 2021

  • 替换至4.4.0.46版本可以正常显示时间戳了,谢谢~~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working not very important
Projects
None yet
Development

No branches or pull requests

2 participants