Skip to content

Instantly share code, notes, and snippets.

View ConAlgorithm's full-sized avatar

Contribute ConAlgorithm

View GitHub Profile
@ConAlgorithm
ConAlgorithm / hdf5.py
Created May 15, 2022 05:42 — forked from Franklin-Yao/hdf5.py
save and read images with hdf5
import os.path as osp
dataset_dir = '/home/frankllin/Downloads/DomainNet'
split_dir = osp.join(dataset_dir, 'splits_mini')
image_size = 84
from PIL import Image
import h5py
import numpy as np
from tqdm import tqdm
def store_many_hdf5(h5file, images, labels):
@ConAlgorithm
ConAlgorithm / find_video_metadata.py
Created June 10, 2022 15:07 — forked from sscarbal/find_video_metadata.py
Python function to retrieve the timestamps of a input video file using ffmpeg.
import subprocess
import shlex
import json
# function to retrieve the timestamps of the input video file
def findVideoMetadata(pathToInputVideo):
cmd = "ffprobe -v quiet -print_format json -show_entries packet=pts_time"
args = shlex.split(cmd)
args.append(pathToInputVideo)
# run the ffprobe process, decode stdout into utf-8 & convert to JSON
@ConAlgorithm
ConAlgorithm / utils.py
Created August 14, 2022 09:47 — forked from Asadullah-Dal17/utils.py
This allow to draw text with color, blur background, it also have functionality to draw transparent shapes,
'''
Author: Asadullah Dal
Youtube Channel: https://www.youtube.com/c/aiphile
'''
import cv2 as cv
import numpy as np
@ConAlgorithm
ConAlgorithm / videos_grid.py
Created August 14, 2022 09:51 — forked from luuil/videos_grid.py
Merging multiple videos into one grid video by opencv and numpy
import cv2
import os
import numpy as np
class ExtractImageFromVideo(object):
def __init__(self, path, frame_range=None, debug=False):
assert os.path.exists(path)
self._p = path