79752624

Date: 2025-09-01 14:12:17
Score: 1.5
Natty:
Report link

I'm not a professional but here's what I've got.

import cv2
import numpy as np

test1=np.zeros((90,90,3))
test2=np.zeros((90,90,3))

img=cv2.imread('colors.png')
img_hsv=cv2.cvtColor(img,cv2.COLOR_BGR2HSV)

light_color=np.array([[[245,183,22]]],dtype="uint8")

test1[0:45,0:90]=cv2.cvtColor(light_color,cv2.COLOR_RGB2BGR)

# [22,232,245]
light_color=cv2.cvtColor(light_color,cv2.COLOR_RGB2HSV)

test1[45:90,0:90]=light_color

light_color=np.ravel(light_color)

dark_color=np.array([[[255,193,32]]],dtype="uint8")

test2[0:45,0:90]=cv2.cvtColor(dark_color,cv2.COLOR_RGB2BGR)

# [22,223,255]
dark_color=cv2.cvtColor(dark_color,cv2.COLOR_RGB2HSV)

test2[45:90,0:90]=dark_color

dark_color=np.ravel(dark_color)

#light_color = np.array([22,232,245])
#dark_color = np.array([32,218,255])

lc_sat=light_color[1]
light_color[1]=dark_color[1]
dark_color[1]=lc_sat

mask=cv2.inRange(img_hsv,light_color,dark_color)
#mask=cv2.inRange(img,np.array([22,232,245],np.uint8),np.array([22,223,255],np.uint8))
mask2=cv2.inRange(img,np.array([22,183,245],np.uint8),np.array([32,193,255],np.uint8))
result=cv2.bitwise_and(img_hsv,img_hsv,mask=mask)
result2=cv2.bitwise_and(img,img,mask=mask2)

cv2.imwrite("hsv_mask1_hsv.png",mask)
cv2.imwrite("hsv_mask2_bgr.png",mask2)
cv2.imwrite("hsv_result1_hsv.png",cv2.cvtColor(result,cv2.COLOR_HSV2BGR))
cv2.imwrite("hsv_result2_bgr.png",result2)
cv2.imwrite("hsv_lightc.png",test1)
cv2.imwrite("hsv_darkc.png",test2)
cv2.imwrite("hsv_colors.png",img_hsv)

enter image description here enter image description here

enter image description here. enter image description here

enter image description here. enter image description here

enter image description here. enter image description here

Reasons:
  • Blacklisted phrase (1): enter image description here
  • Probably link only (1):
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Josip D