Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi I am creating a Rubik's cube detection program for OpenCV in order to detect the colour of each individual cubie however i am struggling to tell the difference between colours such as red, orange and yellow. I have investigated this throughly and tried many different arrays.

Any help would be appreciated if anyone has any better arrays.

The code I have used is below

What I have tried:

"red" : (np.array([160, 75, 75]), np.array([180, 255, 255])),
	"blue" : (np.array([110, 75, 75]), np.array([130, 255, 255])),
	"green" : (np.array([35, 0, 0]), np.array([85, 255, 255])),
	"yellow" : (np.array([20, 75, 75]), np.array([40, 255, 255])),
	"white" : (np.array([0, 0, 20]), np.array([180, 30, 255])),
	"orange" : (np.array([10, 100, 100]), np.array([20, 255, 255]))
Posted
Updated 27-Apr-22 10:38am
Comments
Richard MacCutchan 27-Apr-22 10:16am    
What is the problem?
Emmett O neill 27-Apr-22 10:57am    
its detecting yellow as orange etc because the colors are similar and im unsure how to solve this issue despite the research I've carried out

1 solution

Maybe because you have overlap between the yellow and orange ranges?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900