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

timelapse project #26

Open
flfphotography opened this issue Nov 9, 2021 · 0 comments
Open

timelapse project #26

flfphotography opened this issue Nov 9, 2021 · 0 comments

Comments

@flfphotography
Copy link

I am trying to build timlapses off of the code used to capture and compile a timelapse. I wave deleted the code for capturing images as I simply want to use images take with my personal camera. I have also done my best (I'm very new to this) to remove references to other code files like the utils.py file. I wanted this to be a simple and stand alone code for my sake. As far as I can tell, it works. it pulls all the files I want and creates a video, the problem is that the video is extremely choppy and isn't much better running at lower resolution. this is what I've got.

`import os
import numpy as np
import cv2
import time
import datetime

import glob

#Vairables
frames_per_second = 24
save_path='saved-media/timelapse.mp4'

out = cv2.VideoWriter(save_path, cv2.VideoWriter_fourcc(*'mp4v'), frames_per_second, (1620, 1080))
timelapse_img_dir = r'E:\Nature\Sky captures\2021-10-19_Timelapse_PythonFJPG'

clear_images = False

def images_to_video(out, timelapse_image_dir, clear_images=False):
image_list = glob.glob(f"{timelapse_image_dir}/*.JPG")
sorted_images = sorted(image_list, key=os.path.getmtime)

for file in sorted_images:
    ImageToVideoFrames = cv2.imread(file)
    out.write(ImageToVideoFrames)
return (0)

images_to_video(out, timelapse_img_dir)
out.release()
cv2.destroyAllWindows()
print ('complete')`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant