hello
when i use the VLIB2.0 to realize mixture of gaussion in DM6437,I can run through the project,but i cant get the foreground region of my image.when i view the memory of the outputImage buffer ,i only can see zero.And when i view the image of the fgMask buffer through the tool of Gragh,i can see it is a offset of my original image.The specific procedures is as follow.Is it a problem of my original image? or other problems? Any insight would be much appreciated! Thanks!
Int16 updateRate1 = 0.001 * MAX_S16/MAX_0p16;
Int32 updateRate2 = 0.001 * 2147483648;
Int32 mdThreshold = (2.5*2.5) * 134217728;
Int16 bsThreshold = 0.5 * MAX_S16/MAX_0p16;
Int16 initialWt = (MAX_S16/MAX_0p16)/1000;
Int32 initialVar = 320 * 32768;
char fileDirs[5][50]={
"E:\\8168lib\\DM6437-GMM\\DM6437 GMM\\a.bmp",
"E:\\8168lib\\DM6437-GMM\\DM6437 GMM\\a.bmp",
"E:\\8168lib\\DM6437-GMM\\DM6437 GMM\\a.bmp",
"E:\\8168lib\\DM6437-GMM\\DM6437 GMM\\a.bmp",
"E:\\8168lib\\DM6437-GMM\\DM6437 GMM\\a.bmp"
};
int width;
int height;
Int32 pixNum;
Int32 imgNum = 5;
//==================================
width = get_image_width(fileDirs[0]);
height = get_image_height(fileDirs[0]);
pixNum = width*height;
currentMeans = (int *)MEM_alloc(0,sizeof(Int32)*pixNum*3,16);
currentVars = (int *)MEM_alloc(0,sizeof(Int32)*pixNum*3,16);
currentWgts = (short *)MEM_alloc(0,sizeof(Int16)*pixNum*3,16);
intBuffer = (unsigned char *)MEM_alloc(0,sizeof(Uint8)*pixNum,8);
compIndex = (unsigned char *)MEM_alloc(0,sizeof(Uint8)*pixNum,8);
fgMask = (unsigned int *)MEM_alloc(0,sizeof(Uint32)*pixNum/32,32);
inputImage = (unsigned char *)MEM_alloc(0,sizeof(Uint8)*pixNum,8);
outputImage = (unsigned char *)MEM_alloc(0,sizeof(Uint8)*pixNum,8);
memset(inputImage, 0, pixNum);
for(i=0;i<pixNum*3;i++){
currentMeans[i] = 0;
currentVars[i] = 0;
currentWgts[i] = 0;
};
// 高斯混合模型
for(m = 0; m < imgNum; m++)
{
get_image_pointer(fileDirs[m], inputImage,pixNum);
VLIB_mixtureOfGaussiansS32(inputImage,
currentWgts,
currentMeans,
currentVars,
compIndex,
intBuffer,
fgMask,
pixNum,
updateRate1,
updateRate2,
mdThreshold,
bsThreshold,
initialWt,
initialVar);
VLIB_unpackMask32(fgMask,outputImage,pixNum);
for ( i = 0; i < pixNum; i++)
*(outputImage + i) = *(outputImage + i) * 255;
printf("Test Paused!");// toggle breakpoint here to see the result
}
printf("\nEnd of the Test!\n");
//===========================
MEM_free(DDR2HEAP,intBuffer,sizeof(Uint8)*pixNum);
MEM_free(DDR2HEAP,compIndex,sizeof(Uint8)*pixNum);
MEM_free(DDR2HEAP,inputImage,sizeof(Uint8)*pixNum);
MEM_free(DDR2HEAP,outputImage,sizeof(Uint8)*pixNum);
MEM_free(DDR2HEAP,currentWgts,sizeof(Int16)*pixNum*3);
MEM_free(DDR2HEAP,currentVars,sizeof(Int32)*pixNum*3);
MEM_free(DDR2HEAP,currentMeans,sizeof(Int32)*pixNum*3);
MEM_free(DDR2HEAP,fgMask,sizeof(Uint32)*pixNum/32)