colors

How do I reliably classify colours as red, yellow, or "other" colours in OpenCV?

How do I reliably classify colours as red, yellow, or "other" colours in OpenCV? Question: I have an input image from which I extracted the circles for a robotics project, and then got the average colour within those circles. The circles can either have a red or yellow colour as that is how I painted …

Total answers: 1

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

How to compare against and modify values of NumPy array

How to compare against and modify values of NumPy array Question: I am trying to convert a numpy array to a .vox file. .vox files have a limit where they can only store 255 unique colors. My numpy array is being somewhat randomly generated, so it’s length and values are not always the same. However, …

Total answers: 1

Color property of plotly bar charts not working for me

Color property of plotly bar charts not working for me Question: Hy i’m trying to generate a Chart using plotly express and i just can’t get my head around how to apply the correct colours to the bar. (i need a specific color for 1 bar ) End result wanted So far i have a …

Total answers: 2

Plotly Dash change networkx node colours in based on user input?

Plotly Dash change networkx node colours in based on user input? Question: After creating the minimal working example below, I tried to change the color of the nodes in the graphs based on user input. Specifically, I have n lists of colors (one color per node), and I would like the user to be able …

Total answers: 2

subprocess stdout without colors

subprocess stdout without colors Question: I am running a command line tool that returns a coloured output (similar to ls –color). I run this tool via subprocess: process = subprocess.run([‘ls –color’], shell=True, stdout=subprocess.PIPE) process.stdout.decode() But the result is, of course, with the color instructions like x1b[mx1b[m which makes further processing of the output impossible. How …

Total answers: 2

How to show different colors on a plot for values from different columns

How to show different colors on a plot for values from different columns Question: Please consider the small dataframe test: import pandas as pd import matplotlib.pyplot as plt df = pd.DataFrame( [ [1, 1.0, 0.0, 0.0], [1, 0.75, 0.25, 0.0], [1, 0.576, 0.396, 0.028] ], columns = ["State", "1", "2", "3"] ) I am now …

Total answers: 2

how to accelerate the numpy for-loop, for coloring point-cloud by its intensity

how to accelerate the numpy for-loop, for coloring point-cloud by its intensity Question: enter code hereI want to color a point-cloud by its intensity. currently I use the following for-loop to apply a colormap function to the intensity(4th-dim) of points: import numpy as np points = np.random.random([128*1200,4]) points_colors = np.zeros([points.shape[0], 3]) for idx, p_c in …

Total answers: 1

Detect almost grayscale image with Python

Detect almost grayscale image with Python Question: Inspired by this question and this answer (which isn’t very solid) I realized that I often find myself converting to grayscale a color image that is almost grayscale (usually a color scan from a grayscale original). So I wrote a function meant to measure a kind of distance …

Total answers: 2

How to detect background color on hover Python?

How to detect background color on hover Python? Question: Does anyone know, how you can detect the color on which you’re hovering with your cursor with python and returning the color to a string? Asked By: YeagerCS || Source Answers: Solution for Windows: def get_cursor_color(): # Get the cursor position pt = ctypes.wintypes.POINT() ctypes.windll.user32.GetCursorPos(ctypes.byref(pt)) # …

Total answers: 1