This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#*** | |
# USAGE: python snapshot.py -l optionalCustomLabelHere | |
#*** | |
# | |
# Take snapshots with your webcam. | |
# - Exit with ESC | |
# - Snapshot with SPACE | |
# | |
# NOTE: | |
# -Change webcam src to your usb port number (Line 29) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pynput.keyboard import Key, Listener | |
#--- Helper Function --- | |
def alphanumeric_filter(key): | |
''' | |
Return alphanumeric keys as a char type and special keys as a key type | |
''' | |
try: | |
return key.char | |
except AttributeError: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
def print_decorator(func): | |
""" | |
Overload Print function to pretty print Dictionaries | |
""" | |
def wrapped_func(*args,**kwargs): | |
if isinstance(*args, dict): | |
return func(json.dumps(*args, sort_keys=True, indent=2, default=str)) | |
else: | |
return func(*args,**kwargs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ----------------------------- | |
# USAGE | |
# ----------------------------- | |
# chmod +x mrcnn_continous_run.sh | |
# source mrcnn_continous_run.sh | |
# | |
# DESCRIPTION: | |
# Allows matterport's MRCNN to run in sections so that every few epochs it re-executes | |
# and, therefore, resets the memory solving provisionally the memory leak issue. | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /opt/carnd_p3/behavioral/bin/python3 | |
from workspace_utils import active_session | |
import os | |
import subprocess | |
with active_session(): | |
# do long-running work here | |
os.system("/opt/carnd_p3/linux_sim/linux_sim.x86_64") | |
print("hello") | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Concatenate (glue) two videos given the two inputs and output paths | |
# (if destination path not specified it uses same as first input path) | |
# by Bryan Laygond | |
# USAGE: | |
# python gluevideos.py --v1 "Path/to/first/source/file" \ | |
# --v2 "Path/to/second/source/file" \ | |
# --output "Path/to/destination/file" | |
import os |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Trims a video given start and end time and input and ouput path | |
# (if time not specified it assumes beginning or end of video) | |
# (if destination path not specified it uses same as input path) | |
# by Bryan Laygond | |
# USAGE: | |
# python videotrim.py --input "Path/to/source/file" \ | |
# --output "Path/to/destination/file" \ | |
# --start 2.0 \ | |
# --end 7.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#https://medium.com/@TejasBob/moviepy-is-awesome-part2-73b04e2338b0 | |
from moviepy.editor import * | |
import moviepy.video.fx.all as vfx | |
clip = VideoFileClip(path/to/downloaded/video) | |
clip = clip.resize(0.4) | |
sub = clip.subclip(179, 182) | |
sub = sub.fx(vfx.crop, x1=115, x2=399, y1=0, y2=288) | |
clip2 = sub.speedx(final_duration=2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/antiboredom/automating-video/blob/master/moviepy-tutorial.md | |
import random | |
import moviepy.editor as mp | |
original_video = mp.VideoFileClip(videofile) | |
duration = original_video.duration | |
segment_length = .5 | |
clips = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pip3 install -U imageio-ffmpeg # It contains VideoFileClip module and must be installed from shell | |
#from moviepy.editor import VideoFileClip,ImageSequenceClip # Must be added in the beginning with the rest of imported modules | |
# Define Input and Output folder (USER must Edit) | |
video_name = "sample.mp4" | |
video_name_part = video_name.split(".") # sample & mp4 has been split | |
input_video_path = os.path.join("Input_Video", video_name) | |
output_images_path = os.path.join("Output_Video", "Processed_Images") # This is a temporary folder to hold processed images | |
output_video_path = os.path.join("Output_Video", video_name_part[0] + "_output." + video_name_part[1]) |
NewerOlder