Skip to content

Instantly share code, notes, and snippets.

View yatharthb97's full-sized avatar

Yatharth Bhasin yatharthb97

View GitHub Profile
@yatharthb97
yatharthb97 / pylibcamera.py
Created July 4, 2024 14:56
Author chatgpt: for tests
import pylibcamera as plc
# Initialize the CameraManager
camera_manager = plc.CameraManager()
camera_manager.start()
# List available cameras
cameras = camera_manager.cameras
for i, camera in enumerate(cameras):
print(f"Camera {i}: {camera}")
@yatharthb97
yatharthb97 / timestamper.py
Created August 18, 2023 16:18
Plots a graph of the creation time (milliseconds) of all files in a folder.
import os
from datetime import date
import datetime
import matplotlib.pyplot as plt
def file_timestamp_graph(dir_="."):
all_files = list(os.listdir(dir_))
all_files.sort()
@yatharthb97
yatharthb97 / framecount.py
Created May 29, 2023 16:09
For counting the number of frames from a video file without reading the whole video in memory.
#On bash
ffprobe -v error -select_streams v:0 -count_packets \
-show_entries stream=nb_read_packets -of csv=p=0 <filename>
# On Jupyter
! ffprobe -v error -select_streams v:0 -count_packets \
-show_entries stream=nb_read_packets -of csv=p=0 {filename}
from numpy import arange
from picamera import PiCamera
def read_cam_config(camera):
config_dict = {
'resolution' : camera.resolution,
'framerate' : camera.framerate,
'ISO' : camera.iso,
'ana_gain' : camera.analog_gain,
'dig_gain' : camera.digital_gain,
import cv2
from vmbpy import *
import time.sleep as sleep
with VmbSystem.get_instance () as vmb:
cams = vmb.get_all_cameras ()
with cams[0] as cam:
print(cam)
for i in range(10):
@yatharthb97
yatharthb97 / tmliteral.py
Last active July 16, 2022 15:41
A module for managing and parsing string to time literals in python.
#!/usr/bin/env python3
#!/usr/bin/env python
'''
Time Literals (tmliteral.py)
---------------------------
Author: Yatharth Bhasin (GitHub → yatharthb97)
Brief: A module for managing and parsing string to time literals in python.
This piece of software was released on GistHub → https://gist.github.com/yatharthb97/8798b23a1611a90b056e2026bbed63a8
@yatharthb97
yatharthb97 / configr.py
Created February 26, 2022 11:08
Tool to import, verify, and generate config files {json and yaml} for python.
# -*- coding: utf-8 -*-
#!/usr/bin/env python3
#!/usr/bin/env python
"""
Configuration file manager for yaml and json.
Tool to import, verify, and generate config files {json and yaml} for python.
Author : *Yatharth Bhasin* (Github → yatharthb97)
@yatharthb97
yatharthb97 / metadata.py
Last active April 12, 2023 23:05
Object that is specialized to collect, store, and export metadata for any generic application.
#!/usr/bin/env python3
#!/usr/bin/env python
"""
Metadata aggregator
Object that is specialized to collect, store, and export metadata for any generic application.
Author : *Yatharth Bhasin* (Github → yatharthb97)
License: *MIT open-source license* (https://opensource.org/licenses/mit-license.php)
This piece of software was released on GistHub : TODO
@yatharthb97
yatharthb97 / circular_buffer.hpp
Created January 7, 2022 19:16
Implementation of simple Circular Buffer with bounded index random accessor.
#pragma once
#include <sstream>
/* CIRCULAR BUFFER
Implementation of simple Circular Buffer with bounded index random accessor.
---
Author : Yatharth Bhasin
Licence : MIT Licence (Text → https://opensource.org/licenses/MIT)
---
*/