Skip to content

Instantly share code, notes, and snippets.

View shrimo's full-sized avatar

Shri Moo shrimo

View GitHub Profile
@shrimo
shrimo / GPTDescriptor.py
Last active October 10, 2023 11:42
an attempt to speed up the calculation of the descriptor when communicating with ChatGPT
#!/usr/bin/python3
# read, akaze and show
import cv2
import multiprocessing
# Function to read video frames
def read_video_stream(video_file, frame_queue):
cap = cv2.VideoCapture(video_file)
@shrimo
shrimo / mp_tiled_frame.py
Last active August 1, 2023 18:30
Dividing the frame into tiles
#!/usr/bin/python3
# Dividing the frame into tiles
import multiprocessing
import numpy as np
import cv2
class OpenCV_Multiprocessing:
def __init__(self, features):
@shrimo
shrimo / ReduceDraw.py
Last active August 8, 2023 23:32
Draw no loops in OpenCV
class ReduceDraw:
"""
Class for drawing many objects without loops
"""
__slots__ = ['frame_tmp','color', 'size', 'font']
def __init__(self, color = (0, 0, 255), size = 10):
self.frame_tmp = None
self.color = color
self.size = size
self.font = cv2.FONT_HERSHEY_SIMPLEX
@shrimo
shrimo / fft.py
Last active March 26, 2023 22:55
FourierTransform
import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread('image_big.png')
img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
rows, colss = img.shape
crow, ccol = rows//2 , colss//2
print(crow, ccol)
@shrimo
shrimo / strange.py
Created March 4, 2023 18:28
strange object behavior
class CX:...
CX.m = lambda x : x
a = CX
CX.n = lambda y : y
b = CX
print(a is b)
print(id(a.n(a)) is id(b.m(b)))
print(id(a.n(a)) == id(b.m(b)))
@shrimo
shrimo / random_youtube.py
Last active November 13, 2022 02:48
Random YouTube Video
'''
Random YouTube Video
It's just for fun, generate a random string
and try to find a youtube video with that string's id
'''
import random
import string
import requests
@shrimo
shrimo / Memorizer.py
Last active September 1, 2022 00:16
Memorizer
class DataBuffer:
""" Observer pattern """
def __init__(self):
self.memory = None
def remember(self, memory):
self.memory = memory
def recall(self):
out = self.memory
read_list=[]
for i in nuke.allNodes():
if i.Class() == ('Read'):
read_list.append(i.knob('file').getValue())
for rl in read_list:
if '/bstorage/strg01/mnt/projects/mavka/render/' in rl:
print rl
@shrimo
shrimo / daily_view.py
Last active May 25, 2020 15:39
Daily view (Load the latest version of daily)
"""
Load the latest version of daily
import sys
module_path = '/home/shrimo/Desktop/course/vfx_dev/nuke'
if module_path not in sys.path:
sys.path.append(module_path)
import daily_view
reload(daily_view)
@shrimo
shrimo / find_version.py
Last active May 13, 2020 17:31
find render version
"""
Find render version
import sys
module_path = '/home/shrimo/Desktop/course/vfx_dev/nuke'
if module_path not in sys.path:
sys.path.append(module_path)
import find_version
reload(find_version)