Ask Your Question

Which colour space is best for extracting real world objects?

asked 2018-05-09 08:39:42 -0500

Santhosh1 gravatar image

updated 2018-05-09 22:59:02 -0500

I am currently extracting objects of interest setting a lower limit range and a upper limit range using these colour spaces


I am having issues extracting a black colour cloth in varying lighting conditions.

Which colour space is most accurate to the human perception of colour, which we have in OpenCV?

Can't find online which colourspace is the most accurate representation of human perception.

Can anyone help??????

edit retag flag offensive close merge delete


For what it's worth, humans have a genetic tendency to see green better than red or blue. I think it has something to do with the colour of plants back when we were tree huggers. It's also common to have a colour space where the bits are 5 for red, 6 for green, and 5 for blue -- this is instead of 8 8 8 in a 24-bit RGB image.

sjhalayka gravatar imagesjhalayka ( 2018-05-09 10:43:45 -0500 )edit

@sjhalayka I red up on the link you posted. Which one I use for my use case is still a mystery. I'm currently considering using LAB over YUV

Santhosh1 gravatar imageSanthosh1 ( 2018-05-09 23:14:54 -0500 )edit

unfortunately, black (or white) is NOT a colour. it can be any hue (or uv or ab value), so you can only rely on Y or L here.

maybe you're better off, doing this in bgr space, and check for low values of all 3 channels.

berak gravatar imageberak ( 2018-05-10 02:24:23 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2018-05-10 04:50:56 -0500

Santhosh1 gravatar image

@berak Instead of scratching my head finding the range of values in any of the colour spaces. I just turned image to grayscale threshold the image its giving satisfactory result.

edit flag offensive delete link more


@Santhosh1 -- You could also try out YCrCb:

Look at the code given in the answer:

Y =   16 +  65.738*R/256 + 129.057*G/256 +  25.064*B/256
Cb = 128 -  37.945*R/256 -  74.494*G/256 + 112.439*B/256
Cr = 128 + 112.439*R/256 -  94.154*G/256 -  18.285*B/256

Look at how much more green contributes to Y over red and blue. Green is special, I tell ya.

sjhalayka gravatar imagesjhalayka ( 2018-05-10 21:40:35 -0500 )edit

Question Tools



Asked: 2018-05-09 08:39:42 -0500

Seen: 110 times

Last updated: May 09 '18