This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
from sklearn.cluster import KMeans | |
class DominantColors: | |
CLUSTERS = None | |
IMAGE = None | |
COLORS = None | |
LABELS = None | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |