Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
i have this error when build my code

Unhandled exception at 0x00ce88ef in mycode.exe: 0xC0000005: Access violation reading location 0x000003bc.

my code is

C++
void LBPFeatures::computeuniformlbp(Mat image,Mat &dst)
{
    uchar *ptr=image.data;
    image.copyTo(dst);
    uchar *optr=dst.data;
    int width=image.cols;
    int height=image.rows;

    for(int i=1;i<height-1;i++)
    {
        for(int j=1;j<width-1;j++)
        {
            int center=(int)ptr[j+i*width];
            unsigned char code=0;


            code|=((int)ptr[(j-1)+(i-1)*width] >=center)<<7;
            code|=((int)ptr[j+(i-1)*width] >=center)<<6 ;
            code|=((int)ptr[(j+1)+(i-1)*width] >=center)<<5 ;
            code|=((int)ptr[(j+1)+(i)*width] >=center)<<4 ;
            code|=((int)ptr[(j+1)+(i+1)*width] >=center)<<3 ;
            code|=((int)ptr[j+(i+1)*width] >=center)<<2 ;
            code|=((int)ptr[j-1+(i+1)*width] >=center)<<1 ;
            code|=((int)ptr[j-1+(i)*width] >=center)<<0 ;

        
            optr[j+i*width]=lookup[code];

        }
    }
    initUniform();
}



the image is loaded correctly but there is an error with variable code or with ptr really i don't know

can any one help me
thanks in advance
Posted
Updated 25-May-14 2:05am
v2
Comments
Sergey Alexandrovich Kryukov 24-May-14 22:18pm    
In what line?
—SA

1 solution

make some debug output and interval checking code. It will lead to your bug ;-)

My tip is

C++
optr[j+i*width]=lookup[code];
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900