Skip to content

Instantly share code, notes, and snippets.

View xyangwu's full-sized avatar
💭
#tired...

xyangwu

💭
#tired...
View GitHub Profile
@jazzycamel
jazzycamel / threads1.py
Last active March 29, 2023 21:49
Simple example of the correct way to use (Py)Qt(5) and QThread
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from itertools import count, islice
class Threaded(QObject):
result=pyqtSignal(int)
def __init__(self, parent=None, **kwargs):
super().__init__(parent, **kwargs)
@clungzta
clungzta / transparent_overlay_cv2.py
Created March 28, 2017 10:20
Example for overlaying a transparent image onto a background image using cv2
import numpy as np
import cv2
img = cv2.imread('background.jpg')
overlay_t = cv2.imread('foreground_transparent.png',-1) # -1 loads with transparency
def overlay_transparent(background_img, img_to_overlay_t, x, y, overlay_size=None):
"""
@brief Overlays a transparant PNG onto another image using CV2