Skip to content

Instantly share code, notes, and snippets.

View haiderasad's full-sized avatar
💭
mastering AI

Haider Asad haiderasad

💭
mastering AI
View GitHub Profile
@navenduagarwal
navenduagarwal / dummyimage.py
Created June 14, 2018 06:09
python script to create dummy image via opencv
import cv2
import numpy as np
def create_blank(width, height, rgb_color=(0, 0, 0)):
"""Create new image(numpy array) filled with certain color in RGB"""
# Create black blank image
image = np.zeros((height, width, 3), np.uint8)
# Since OpenCV uses BGR, convert the color first
@skt7
skt7 / dominat-colors.py
Last active November 10, 2022 15:04
Dominant Colors in an image using python opencv and scikit-learn
import cv2
from sklearn.cluster import KMeans
class DominantColors:
CLUSTERS = None
IMAGE = None
COLORS = None
LABELS = None
@xcsrz
xcsrz / center_text_on_image.py
Created March 8, 2017 00:17
Center text on an image with Python and OpenCV. Had to come up with it myself as no one was spelling this out anywhere (or google couldn't find it)
#!/usr/bin/env python
import numpy as np
import cv2
from time import sleep
# create blank image - y, x
img = np.zeros((600, 1000, 3), np.uint8)
# setup text