opencv - Simple method to extract specific color range from an image in Python? - Stack Overflow
I created a web application to extract a color palette from an image.
Flask app to extract palette of dominating colors from image
Grease Pencil - Extract color palette from image (Blender 2.83 Tutorial)
How accurate is the color extraction?
What color formats does PixDuplicate's color picker support?
Can I pick colors from transparent PNG images?
Videos
It was a pretty simple issue; you gave a larger color before a smaller one to cv.inRange, so there was no valid intersection! Here's some working code that shows the output. This should be easy to adapt into your own script.
import cv2 as cv
import numpy as np
import matplotlib.pyplot as plt
img = cv.imread('shuttle.jpg') # you can read in images with opencv
img_hsv = cv.cvtColor(img, cv.COLOR_BGR2HSV)
hsv_color1 = np.asarray([0, 0, 255]) # white!
hsv_color2 = np.asarray([30, 255, 255]) # yellow! note the order
mask = cv.inRange(img_hsv, hsv_color1, hsv_color2)
plt.imshow(mask, cmap='gray') # this colormap will display in black / white
plt.show()
you can download colorgram module from pypi in this method you can extract as many colors you want from one picture
note : your image name should be in the same file of your main , that you can see here in my code (turtle.jpg) otherwise you can give the colorgram the number of colors that you want to be extracted : as in my case (30)
import colorgram
from extraction import Extraction
colors = colorgram.extract('turtle.jpg',30)
# print(colors)
list = []
for color in colors:
# print(color)
r = color.rgb.r
g = color.rgb.g
b = color.rgb.b
new_color = (r,g,b)
list.append(new_color)
print(list
I created a web application, getcolor.codes, to extract a color palette from an image. It's free and has no ads (so far). I'm wondering how useful it is and what advice you could give me, such as what features could be added or what needs to be fixed.
Screenshot