How to match color [closed]
I am trying to do a vehicle color recognition program. I have managed to extract the color from vehicle. I can get the color histogram too.
Now i am stuck in matching the extracted color with a predefined color.
- How can i predefined colors (red,blur,green,black,white and etc)?
- How can i compare the extracted color with the predefined color?
There is many ways to define a color BGR HSV Luv... First choose color space. Then you can define distance (metric see wikipedia) between two colors. See Macadam ellipse
i am using HSV. I can compare to histogram and take the distance.
But i don't know how to define a histogram for a color (red,blue,black,white,etc)
If you are trying to achieve a formula to make the color, then you must cross over from RGB to RYB, and that is the tough one. The problem with color is there are additive (paint mixing) and subtractive (computer screen) color formulas. They are very, very different. I came across a formula that was supposed to be it...you could find it with a little Google searching. Computers are too precise..and automotive colors fade with UV exposure.
so because of the environmental reasons the color systems changes. so when i put thresholds to colors i should make it relative to something. using table of color with constant threshold will not work in practical scenario. so what should i do for this? what methods should i use??
There is no method. Spend 5 minutes researching RGB to RYB conversion. You need to figure out the processing for yourself.
RYB or HSV? because when i googled lot of people has said that HSV is the best way.
RYB isnt available as an option, since it is not additive. All I am saying is if you are trying to get a paint formula to mix paint to use in real life, then you have to convert to RYB. You cannot mix paint using RGB, CMYK, HSV or any other computer (additive) colors. Paint uses subtractive color theory. Computers use additive color theory. If you are keeping it digital and the color will never be made in real life, then disregard all I have said.
i am not trying to mix colors. i am using this system for vehicle identification. so as you say for that HSV is ok, as i am not mixing color for real right?
If you are looking for an ID from colors, then use whatever gives you the most accurate results. It will be darker without sun, and brighter in the sun. Im not sure how you will adjust for that, plus shadows and so on. Good luck. I would use the license plate for ID, but that is just me.