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.

Qusetion On VLIB_mixtureOfGaussiansS16

I use the VLIB_mixtureOfGaussiansS16  to test a video frame,but i found that  the foreground is always zero...

#define num_frame 100
#define num_pixels 352*288

 

/* DECLARE AND INITIALIZE MIXTURE OF GAUSSIANS PARAMETERS */
/* update rate for weights, SQ0.15 */
int16_t updateRate1 = 0.001 * INT16_MAX / VLIB_MAX_0p16;
/* update rate for means and variances, SQ0.31 */
int32_t updateRate2 = 0.001 * INT32_MAX / VLIB_MAX_0p16;
/* mahalanobis distance threshold, SQ4.27 */
int32_t mdThreshold = (2.5 * 2.5) * (INT32_MAX / VLIB_MAX_4p12);
/* background subtraction threshold, SQ0.15 */
int16_t bsThreshold = 0.9 * INT16_MAX / VLIB_MAX_0p16;
/* initial weight for new component, SQ0.15 */
int16_t initialWt = 0.001 * (INT16_MAX / VLIB_MAX_0p16);
/* initial variance for new component, SQ16.15 */
int32_t initialVar = 320 * (INT32_MAX / VLIB_MAX_16p16);

*((volatile unsigned int *) 0x1840020) &= 0x00; //close L1P cache
*((volatile unsigned int *) 0x1840040) &= 0x00; //close L1D cache
*((volatile unsigned int *) 0x1840000) &= 0x00; //close L2 cache

int32_t Input_Image_Addr = 0xC0000000;
uint32_t temp_Image_Addr = 0xC0000000;

uint32_t Mid_Plus_fgMask_Data_Addr = 0xC6000000;
uint32_t currentWts_addr = Mid_Plus_fgMask_Data_Addr;
uint32_t currentMeans_addr = currentWts_addr + num_pixels * 3 * sizeof(int16_t);
uint32_t currentVars_addr = currentMeans_addr + num_pixels * 3 * sizeof(int16_t);
uint32_t compIndex_addr = currentVars_addr + num_pixels * 3 * sizeof(int16_t);
uint32_t intBuffer_addr = compIndex_addr + num_pixels * sizeof(uint8_t);
uint32_t fgMask_addr = intBuffer_addr + num_pixels * sizeof(uint8_t);

uint8_t* volatile inputIm = (uint8_t *)Input_Image_Addr;

int16_t* volatile currentWts = (int16_t *)currentWts_addr;
int16_t* volatile currentMeans = (int16_t *)currentMeans_addr;
int16_t* volatile currentVars = (int16_t *)currentVars_addr;
uint8_t* volatile compIndex = (uint8_t *)compIndex_addr;
uint8_t* volatile intBuffer = (uint8_t *)intBuffer_addr;
uint32_t* volatile fgMask = (uint32_t *)fgMask_addr;

for(i = 0 ; i < num_frame ; i++)
{
memcpy((void *)Input_Image_Addr , (void *)(temp_Image_Addr + i*num_pixels) , num_pixels);
//dsp start run the gmm algotirhm

fail = VLIB_mixtureOfGaussiansS16(inputIm,
currentWts,
currentMeans,
currentVars,
compIndex,
intBuffer,
fgMask,
num_pixels,
updateRate1,
updateRate2,
mdThreshold,
bsThreshold,
initialWt,
initialVar);

}

Any help would be much appreciated!

  • Hi A_Eagle.

    Have you checked the usage of the kernel shown in the VLIB test cases in the library.
    vlib_c66x_3_2_0_2\packages\ti\vlib\src\VLIB_mixtureOfGaussiansS16

    Please note the returned foreground image is 32bit packed binary image. Are you saying all the values of the the fgMask are zero. Also, Can you confirm that you have passed single channel data to the API( luminance only).

    Regards,
    Rahul
  • Rahul

    The problem's been solved. The vlib_c674x_3_1_0_9 VLIB_mixtureOfGaussiansS16 demo has s bug,
    I change the input paramter

    /* DECLARE AND INITIALIZE MIXTURE OF GAUSSIANS PARAMETERS */
    /* update rate for weights, SQ0.15 */
    int16_t updateRate1 = 0.001 * INT16_MAX / VLIB_MAX_0p16;
    /* update rate for means and variances, SQ0.15 */
    int16_t updateRate2 = 0.001 * INT16_MAX / VLIB_MAX_0p16;
    /* mahalanobis distance threshold, SQ4.11 */
    int16_t mdThreshold = (2.5 * 2.5) * (INT16_MAX / VLIB_MAX_4p12);
    /* background subtraction threshold, SQ0.15 */
    int16_t bsThreshold = 0.9 * INT16_MAX / VLIB_MAX_0p16;
    /* initial weight for new component, SQ0.15 */
    int16_t initialWt = 0.001 * (INT16_MAX / VLIB_MAX_0p16);
    /* initial variance for new component, SQ12.3 */
    int16_t initialVar = 320 * (INT16_MAX / VLIB_MAX_12p4);

    It can display the foreground

    Thanks for your reply.