Click here to Skip to main content
15,893,381 members

Comments by ssssdaaads (Top 3 by date)

ssssdaaads 16-Oct-12 7:35am View    
could u tell me the mean of entire below instruction?
bgModel[index].mode[m].r[i] = curTextureHist[index].r[i];
ssssdaaads 12-Oct-12 5:07am View    
and this is texture function.What do you think now.
By the way ,Thank u.
const int REGION_R = 5; // Note: the code currently assumes this value is <= 7
const int TEXTURE_POINTS = 6; // Note: the code currently assumes this value is 6
const int TEXTURE_R = 2; // Note: the code currently assumes this value is 2
const int NUM_BINS = 64; // 2^TEXTURE_POINTS
const int HYSTERSIS = 3;
const float ALPHA = 0.01f;
const float THRESHOLD = 0.7*(REGION_R+REGION_R+1)*(REGION_R+REGION_R+1)*NUM_CHANNELS;
const int NUM_MODES = 1; // The paper describes how multiple modes can be maintained,
// but this implementation does not fully support more than one
struct TextureHistogram
{
unsigned char r[NUM_BINS]; // histogram for red channel
unsigned char g[NUM_BINS]; // histogram for green channel
unsigned char b[NUM_BINS]; // histogram for blue channel
};

struct TextureArray
{
TextureHistogram mode[NUM_MODES];
};

void LBP(RgbImage& image, RgbImage& texture)
{
for(int y = TEXTURE_R; y < image.Ptr()->height-TEXTURE_R; ++y)
{
for(int x = TEXTURE_R; x < image.Ptr()->width-TEXTURE_R; ++x)
{
for(int ch = 0; ch < NUM_CHANNELS; ++ch)
{
unsigned char textureCode = 0;
int centerValue = (int)image(y, x, ch);

// this only works for a texture radius of 2
if(centerValue - (int)image(y-2, x, ch) + HYSTERSIS >= 0)
textureCode += 1;

if(centerValue - (int)image(y-1, x-2, ch) + HYSTERSIS >= 0)
textureCode += 2;

if(centerValue - (int)image(y-1, x+2, ch) + HYSTERSIS >= 0)
textureCode += 4;

if(centerValue - (int)image(y+1, x-2, ch) + HYSTERSIS >= 0)
textureCode += 8;

if(centerValue - (int)image(y+1, x+2, ch) + HYSTERSIS >= 0)
textureCode += 16;

if(centerValue - (int)image(y+2, x, ch) + HYSTERSIS >= 0)
textureCode += 32;

texture(y,x,ch) = textureCode;
}
}
}
}
ssssdaaads 12-Oct-12 4:46am View    
ok.
Thank u.
But we have tow dimension in a frame( hight and width).is the mean of index = x + y * width; x=1:width and y=width.
and in texture(y+j,x+i,2).what is the mean of(2) in it.