GithubHelp home page GithubHelp logo

Comments (1)

syj2347 avatar syj2347 commented on June 18, 2024

I rewrote the code for generating videos, which might be helpful for you.

import cv2
import os
import glob
from tqdm import tqdm

# images route
root_path = os.path.abspath("./results_img")
# output vedio route
video_save_path = os.path.abspath("./frame2vedio")


def generateVedio(name_list):
    global video_save_path
    for i in tqdm(range(len(name_list))):
        person_name = name_list[i]
        frame_path = root_path + "/" + person_name
        image_files = glob.glob(frame_path + "/*.jpg")
        image_files.sort(key=lambda x: int(os.path.splitext(os.path.basename(x))[0].split("_")[-1]))

        size = (2304, 1440)
        fourcc = cv2.VideoWriter_fourcc(*"mp4v")
        # 20 is the FPS, you can change it
        videowrite = cv2.VideoWriter(video_save_path + "/" + person_name + ".mp4", fourcc, 20, size)
        img_array = []
        for filename in image_files:
            img = cv2.imread(filename)
            img_array.append(img)

        for j in range(len(image_files)):
            videowrite.write(img_array[j])

        print("视频{0}.mp4生成完毕!".format(person_name))


if __name__ == "__main__":
    name_list = os.listdir(root_path)
    print(name_list)
    generateVedio(name_list)

Add something like this in demo_camera.py cv2.imwrite('results_img/demo2/demo2_{}.jpg'.format(i), canvas) in order to reserve the images in a folder.

from pytorch-openpose.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.