This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

What should be the color combination for drawing face detection rectangular box which is not following RGB model

Hii TI Community,

In face detect demo of C6748 LCDK

CvScalar        blue = {255, 0, 0, 0};

is drawing blue rectangle across face.

It is working perfect for blue color but when I am changing other values it is making black rectangle. It is not following RGB model.

What model it is following?

If I want to draw red color box what should be CvScalar vale?

CvScalar        red = {0,255, 0, 0, 0}; ???

CvScalar        green = {0,0,255, 0}; ???

Any arbitary color how to represent?

 

With regards,

AS

  • Hi Amlan,

    When I looked at the code, I just came across, this line at "cxcore.h"

    "#define CV_RGB( r, g, b )  cvScalar( (b), (g), (r), 0 )"  // b - blue ; g - green;  r- red 

    so my understanding would be, for white,

    CvScalar   white = {255, 255, 255, 0};

    for green,

    CvScalar   green = {0, 255, 0, 0};

    for red,

    CvScalar   red = {255, 0, 0, 0};

    Try this and let me know how it goes for you....

  • Dear Shankari G ,You are right but it is not working and I don't know why.
    if blue has small value it is converting the image rectangle to blue else it is changing to black.
    CvScalar blue = {255, 0, 255, 0}; Colour o/p isblue
    CvScalar blue = {0, 255,0, 0}; Colour o/p is With regardsAs
  • Dear Sir,
    I am trying from morning till unable to sort out why there z a problem in colour.
    CvScalar blue = {255, 0, 255, 0}; Colour o/p isblue
    CvScalar blue = {0, 255,0, 0}; Colour o/p is black
    CvScalar blue = {0, 0, 0, 0}; Colour o/p is blue
    CvScalar blue = {0,0, 255,0}; Colour o/p is black
    CvScalar blue = {25, 0, 255, 0}; Colour o/p is blue
    CvScalar blue = {255, 255,255, 0}; Colour o/p is blue
    even in small value it is converting to blue else it is taking as 0 i.e. black. other R G has no effect. How to solve this?
    With regards,AS
  • Hi Amlan,

    [quote user="Amlan"] if blue has small value it is converting the image rectangle to blue else it is changing to black.
    CvScalar blue = {255, 0, 255, 0}; Colour o/p isblue
    CvScalar blue = {0, 255,0, 0}; Colour o/p is [/quote ]

    For what value it is changing into black and for what value it is changing into blue? specify that small value??
  • Dear Sir,What may be the RGB value If B> 0 it is blue else it is black.
    Monitor have no effect on other Green and Red value.Please suggest why?
    With regards,AS
  • Hi Amlan,

    CvScalar blue = {255, 0, 255, 0}; Colour o/p isblue
    CvScalar blue = {0, 255,0, 0}; Colour o/p is black
    CvScalar blue = {0, 0, 0, 0}; Colour o/p is blue
    CvScalar blue = {0,0, 255,0}; Colour o/p is black
    CvScalar blue = {25, 0, 255, 0}; Colour o/p is blue
    CvScalar blue = {255, 255,255, 0}; Colour o/p is blue

    If that is the case, either that might be a bug or that is the default way that they would have written it.

    To solve this, I would recommend you to do a step by step debugging on things like "cvScalar" -->  "CV_DEFAULT(0)" etc.

    And also check, whether the value passed on the "(g), (r), 0 )" are taken into effect or what ever may be the value of these parameters, the actual value passed is just "0" through "CV_DEFAULT(0)"!!?? , if that is the case, experiment by modifying  "CV_DEFAULT( 255 ) instead of CV_Default (0), etc.