rgb

How to get varying shades of red colour based on an input value in python?

How to get varying shades of red colour based on an input value in python? Question: In python, how can I get varying shades of the red/yellow colour based on an input value between -1 and 1? If the value is between -1 and 0, the function should return yellow colour. If the value is …

Total answers: 2

Matplotlib displaying RGB pixels weirdly

Matplotlib displaying RGB pixels weirdly Question: I have a set of RGB pixels I gathered from an image, but when I try to save them and display them, they come out very weirdly, as 3 separate colors. It seems like it’s not reading my array as a list of RGB values. I have an abbreviated …

Total answers: 2

RGGB (x,y) –> RGB = (x/2,y/2,3)

RGGB (x,y) –> RGB = (x/2,y/2,3) Question: The output of a camerasensor is SRGGB12. import numpy as np rggb = np.array([[‘R’, ‘G’, ‘R’, ‘G’], [‘G’, ‘B’, ‘G’, ‘B’], [‘R’, ‘G’, ‘R’, ‘G’], [‘G’, ‘B’, ‘G’, ‘B’]]) test2 = np.chararray((3, 4, 4)) test2[:] = ” test2[2,::2, ::2] = rggb[1::2, 1::2] # blue test2[1,1::2, ::2] = rggb[0::2, …

Total answers: 2

Numpy masking in 3 channel array

Numpy masking in 3 channel array Question: The following Snippet will create a test image # Create 3x3x3 image test_image = [] for i in range(9): if i < 6: image.append([255, 22, 96]) else: image.append([255, 0, 0]) Out: array([[[255, 22, 96], [255, 22, 96], [255, 22, 96]], [[255, 22, 96], [255, 22, 96], [255, 22, …

Total answers: 1

Determine basic color names from HEX or RGB in python

Determine basic color names from HEX or RGB in python Question: I am trying to find out if a hex color is "blue". This might be a very subjective thing when comparing different (lighter/ darker) shades of blue or close to blue colors but in my case it does not have to be very precise. …

Total answers: 2

(PYTHON, PILLOW) How to make RGBA image conversion to RGB faster?

(PYTHON, PILLOW) How to make RGBA image conversion to RGB faster? Question: I’m making fade effect by merging .png image with .jpg, but the conversion process takes too long. Is there a way how I could speed up this process? for f in range(101): print(str((200 + f) /3) + "%") if f == 0: im_rgba …

Total answers: 1

How to get one percent for 3 different values?

How can I get one percent for 3 different values? Question: I have this code and it’s supposed to be a color picking game where you can edit different rgb values with the keys:"asd" and "jkl". I want it to give points based on time and accuracy and stuff but I also want a meter …

Total answers: 1

RGB Data in Scatterplot

RGB Data in Scatterplot Question: I posted a question yesterday and was able to piece a few things together but I ran into another snag today. Essentially, I am trying to create a random 2D grid of RGB pixels, plot the RGB data into a 3D Grid to look for patterns and then analyze the …

Total answers: 2

PIL image to numpy

PIL image to numpy Question: I have a NumPy image (2 dimensional) where each pixel range is in thousands. I want to convert it to an RGB image (3-dimensional), with a range from 0 to 255. so I did the following: from PIL import Image import numpy as np image = Image.fromarray(input_image,’RGB’) new_image = np.asarray(image) …

Total answers: 1