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.

DM648 use GMM with VLIB



HI every one

I want to use GMM in DM648 .

And the software I use is ccs V3.3,I modify video_preview code in dvsdk_1_11_00_00_DM648.

And this my code :

 

    FVID_Frame *frameBuffPtr = NULL;

    FVID_Handle disChan, capChan;

    unsigned char *compIndex;

    unsigned char *input   
    unsigned char *intBuffer;
   
    unsigned int *fgMask;

    unsigned char *pBufOut;

    short  *weight;

    short  *mean;

    short  *var;


    int VLIB_error;
   
    short updateRate1 = 0.001 * MAX_S16/MAX_0p16;
  
    short updateRate2 = 0.001 * MAX_S16/MAX_0p16;
   
    short mdThreshold = (2.5*2.5) * (MAX_S16/MAX_4p12);
   
    short bsThreshold = 0.9 * MAX_S16/MAX_0p16;
   
    short initialWt   = 0.001 * (MAX_S16/MAX_0p16);
   
    short initialVar  = 320 * (MAX_S16/MAX_12p4);

   

    weight = (short *)MEM_alloc(0, sizeof(short)*WIDTH*HEIGHT*3, 8);
    mean  = (short *)MEM_alloc(0, sizeof(short)*WIDTH*HEIGHT*3, 8);
    var = (short *)MEM_alloc(0, sizeof(short)*WIDTH*HEIGHT*3, 8);
    compIndex = (unsigned char *)MEM_alloc(0, sizeof(unsigned char)*WIDTH*HEIGHT, 8);
    intBuffer = (unsigned char *)MEM_alloc(0, sizeof(unsigned char)*WIDTH*HEIGHT, 8);
    fgMask = (unsigned int *)MEM_alloc(0, sizeof(unsigned int)*(WIDTH*HEIGHT/32), 8);
    pBufOut=(unsigned char *)MEM_alloc(0, sizeof(unsigned char)*WIDTH*HEIGHT, 8);

    for(i=0;i<WIDTH*HEIGHT*3;i++){
        mean[i] = 0;
        weight[i] = 0;
        var[i] = 0;
    };

 

.

.

.

.

 FVID_exchange(capChan, &frameBuffPtr);

           for(i=0;i<HEIGHT*WIDTH;i++){
               
                *(input+i)=frameBuffPtr->frame.pFrm.y[i];
               
            }

       
      VLIB_error
= VLIB_mixtureOfGaussiansS16(    input,
                                        weight,
                                        mean,
                                        var,
                                        compIndex,
                                        intBuffer,
                                        fgMask,
                                        WIDTH*HEIGHT,
                                        updateRate1,
                                        updateRate2,
                                        mdThreshold,
                                        bsThreshold,
                                        initialWt,
                                         initialVar);

        VLIB_error
=VLIB_unpackMask32(fgMask,pBufOut,HEIGHT*WIDTH);
     


       for(i=0;i<HEIGHT*WIDTH;i++){
               
                frameBuffPtr->frame.pFrm.y[i]=*(pBufOut+i);
               
            }
       FVID_exchange(disChan, &frameBuffPtr);

 

But  the result I get is all zero.

 

Can someone help me to solve this problem,please?

  •  

    Hello che-yung,

    It looks like you have allocated lots of memory. So please make sure that they are allocated correctly.

    Please try printing the VLIB_error variable and see what you get.

    Also try printing few values of input, fgMask and pBufout. This would help identify where the problem starts.

    It is usually more difficult to debug an algorithm with system code. If possible, try testing the algorithm in simulator where system related issues and memory related issues dont have to considered.

    Please let me know what you get trying the above suggestions.

    Regards

    Senthil