uas-at-ucla / suas-23-24

Software/Vision operations for UAS@UCLA, 2023-2024. For a list of tasks, visit https://github.com/orgs/uas-at-ucla/projects/1
3 stars 0 forks source link

Color test #57

Closed AlexanderThaik closed 7 months ago

AlexanderThaik commented 7 months ago

Wrote a script which takes a path to an image and returns a shape color and text color. The script first filters out the background by converting the image to an HSV color space and examining the V (value) channel of the image. If the target is unable to be separated from the background with this method, the S (saturation) channel is used instead. From here, black, white, and brown pixels are counted and removed from the image in RGB color space. Then, pixels of other colors (red, orange, yellow, green, blue, purple) are filtered out using the H channel in HSV. the pixel counts of each color are sorted and the color with the highest pixel count is assigned to the shape color and the second highest becomes the text color.

nathanchan631 commented 7 months ago

LGTM