none
Access Value of pixel using projected3DShape Kinect RRS feed

  • General discussion

  • Hello everyone,

    I need help please as I want to get LBP from a pixel from the innerCornerRightEye for exemple. Here is my code but it doesn't seem to work as I tried to modify color of the pixel but nothing showing up on screen, please need help it's for my thesis. Here is my code, this exemple works only on 3*3 but that's not the problem, thank you in advance:

    ***I call the method LBP with these parameters:

    LBP(

    newPointF(faceTrackFrame.GetProjected3DShape()[FeaturePoint.InnerCornerRightEye].X, faceTrackFrame.GetProjected3DShape()[FeaturePoint.InnerCornerRightEye].Y), 3, colors, imageColor);

    ***Here is the implementation of the LBP Method.

    public

    staticintLBP(PointFpixelPos, intneighbours, Byte[] colors, ColorImageFrameimage)

            {

               

    intstride = image.BytesPerPixel * image.Width;

               

    intcenter = (int)(neighbours / 2);

               

    intavgCol = (colors[((int)(pixelPos.X) * image.BytesPerPixel) + ((int)pixelPos.Y * stride)] + colors[(((int)(pixelPos.X) * image.BytesPerPixel) + ((int)pixelPos.Y * stride)) + 1] + colors[(((int)(pixelPos.X) * image.BytesPerPixel) + ((int)pixelPos.Y * stride)) + 2])/3;

               

    int[,] LBP = newint[neighbours, neighbours];

     

                colors[((

    int)(pixelPos.X) * image.BytesPerPixel) + ((int)pixelPos.Y * stride)] = 255;

                colors[(((

    int)(pixelPos.X) * image.BytesPerPixel) + ((int)pixelPos.Y * stride)) + 1]=255;

                colors[(((

    int)(pixelPos.X) * image.BytesPerPixel) + ((int)pixelPos.Y * stride)) + 2]=255;

               

    for(inti = -center; i <= center; i++)

                {

                   

    for(intj = -center; j <= center; j++)

                    {

                       

    intavg = (colors[((int)(pixelPos.X + i) * image.BytesPerPixel) + ((int)(pixelPos.Y + j) * stride)] + colors[(((int)(pixelPos.X + i) * image.BytesPerPixel) + ((int)(pixelPos.Y + j) * stride)) + 1] + colors[(((int)(pixelPos.X + i) * image.BytesPerPixel) + ((int)(pixelPos.Y + j) * stride)) + 2])/3;

                       

    if(i == 0 && j == 0)

                        {

                            LBP[i + 1,j + 1] = -1;

                        }

                       

    if(avgCol >= avg)

                        {

                            LBP[i + 1,j + 1] = 0;

                        }

                       

    else


                        {

                            LBP[i + 1,j + 1] = 1;

                        }

                    }

                }

               

    intcnt, cntj = 0;

               

    intpow = 0;

               

    intvalue = 0;

               

    for(cnt = 0; cnt < LBP.Length/neighbours; cnt++)

                {

                    value += (

    int)(LBP[cnt,cntj] * Math.Pow(2, pow));

                    pow++;

                }

               

    for(cntj = 1; cntj <= (LBP.Length / neighbours)-1; cntj++)

                {

                   

                    value += (

    int)(LBP[cnt-1,cntj] * Math.Pow(2, pow));

                    pow++;

                }

               

    for(cnt = (LBP.Length / neighbours) - 1; cnt >= 0; cnt--)

                {

                    value += (

    int)(LBP[cnt,cntj-1] * Math.Pow(2, pow));

                    pow++;

                }

                value += (

    int)(LBP[cnt + 1, (LBP.Length / neighbours) - 2] * Math.Pow(2, pow));

               

    returnvalue;

            }

    Friday, June 20, 2014 9:52 AM

All replies