littleBrain
littleBrain

Reputation: 169

Value range for Image HSV for color extraction EMGUCV

In the following,

        Image<Hsv, Byte> hsvimg = img.Convert<Hsv, Byte>();           
        Image<Gray, Byte>[] channels = hsvimg.Split();  
        Image<Gray, Byte> imghue = channels[0];         
        Image<Gray, Byte> imgsat = channels[1];
        Image<Gray, Byte> imgval = channels[2];         

        Image<Gray, byte> huefilter = imghue.InRange(new Gray(?), new Gray(?));            
        Image<Gray, byte> satfilter = imghue.InRange(new Gray(?), new Gray(?));
        Image<Gray, byte> valfilter = imgval.InRange(new Gray(?), new Gray(?));

What is the range value of different channel (h, s, v) for different color extraction? Is it 0-255 or 0-128. I want to detect Orange, Black and Sky blue object for an image.

Upvotes: 3

Views: 8878

Answers (1)

Bala R
Bala R

Reputation: 108997

Can you try something like this for orange

 Image<Gray, byte> huefilter = 
                imghue.InRange(new Gray(Color.Orange.GetHue() - 10), 
                                     new Gray(Color.Orange.GetHue() + 10));   

-10 and +10 is just a guess and could be broad. just play with it and see what works.

for satfilter you can use Color.Orange.GetSaturation()

and for the third one, I'm assuming you can use Color.Orange.GetBrightness()

Upvotes: 2

Related Questions