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.

color issue

hi,

i'm sorry for my illiterate question but i wanted to know how i can create the color it self in the dm6437 platforme i'm working with dvsdk_1_01_00_15 and on the videw_preview example.

        for( xx = 0; xx < (((yRows * xPixels)*2)); xx+=1 )
        {
                      *( ( (unsigned char*)currentFrame ) + xx ) =  some value;
        }

 

what value sholud i i put instande "some value" in order to get fill the screen with the color that i want (blue red yelow..)?

if i put 00 - it gives my green

if i put "FE" - it gives my purple

if i put "80" - it gives me gray

what is the reason for it and how can i controll the colors?

 

thanks for your help,

vadim

  • The frame buffer you are accessing is in an interleaved YCbCr 4:2:2 format, meaning that every other byte is a Y/luma/brightness value, with the remaining values being Cb/Cr/chroma/color. So you end up with a stream of bytes that look like

    ... Cb Y Cr Y Cb Y Cr Y ...

    To properly change the color you cannot just change every single byte in the image to the same value (unless you happen to want a color where Y=Cb=Cr), you need to change every other byte to a certain Y and than the Cb and Cr to certain values to obtain the full range of color options, there is a small tool here (and probably others around the net) you can use to find a set of YCbCr values for a given color.

    To expand upon your code, the pseudo code below is probably close to what you need (haven't tried this but this is what I would expect):

    //Medium Green Color
    #define Y_VALUE 104
    #define CB_VALUE 96
    #define CR_VALUE 90

    for( xx = 1; xx < (((yRows * xPixels)*2)); xx+=2 ) //here we increment by 2 to hit every other byte for Y, we start at the second byte for Y 
            {
                          *( ( (unsigned char*)currentFrame ) + xx ) =  Y_VALUE;
            }

    for( xx = 0; xx < (((yRows * xPixels)*2)); xx+=4 ) //here we increment by 4 to hit every fourth byte for Cb, we start at first byte for Cb (I think)
            {
                          *( ( (unsigned char*)currentFrame ) + xx ) =  CB_VALUE;
            }

    for( xx = 2; xx < (((yRows * xPixels)*2)); xx+=4 ) //here we increment by 4 again to hit every fourth byte for Cr, we start at the third byte for Cr (I think)
            {
                          *( ( (unsigned char*)currentFrame ) + xx ) =  CR_VALUE;
            }

     

  • thanks a lot!!! it works perfectly

  • hie,

    plz tkae time to suggest me,my project is i have to connect a live camera to the dsp and access data rom pc->dsp via ethernet...i jus started collecting data about how to do this...?? can u please suggest how this process can be done????do i need to write a code in CCS now???can u provide me  some ideas fo this???

  • Hi Laila,

    If you could start a new post, better highlighting your requirements it would be beneficial.

    Some quick questions -

    1. Are you using DM6437 EVM or planning to use DM6437/DM6467 on a custom board.

    2. Once PC sends data via ethernet, you can store the data directly, and perform DSP based operations on it, so where is the problem?

    3. Whether you want to write code in CCS3.3 or use Linux based application reference is entirely your choice.

    Regards,

    Sid