如何在没有错误的情况下运行我的统一Lbp C ++ [英] How Can I Run My Uniform Lbp C++ Without Error

查看:98
本文介绍了如何在没有错误的情况下运行我的统一Lbp C ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

构建我的代码时出现此错误



mycode.exe中0x00ce88ef处的未处理异常:0xC0000005:访问冲突读取位置0x000003bc。



我的代码是



  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 *宽度]。
unsigned char code = 0 ;


code | =(( int )ptr [(j- 1 )+(i- 1 )* width]> = center)<< 7;
code | =(( int )ptr [j +(i- 1 )* width] > =中心)<< 6;
code | =(( int )ptr [(j + 1)+(i- 1 )*宽度]> =中心)<< 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();
}







图像加载正确但变量代码出错或用ptr真的我不知道



可以任何人帮我

提前谢谢

解决方案

制作一些调试输出和间隔检查代码。这将导致你的错误;-)



我的提示是



 OPTR [J + I *宽度] =查找[代码]; 


i have this error when build my code

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

my code is

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

解决方案

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

My tip is

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


这篇关于如何在没有错误的情况下运行我的统一Lbp C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆