Visual Studio 2008中的OpenCV [英] opencv in visual studio 2008

查看:92
本文介绍了Visual Studio 2008中的OpenCV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Visual Studio 2008中研究opencv

我访问灰度图像的imageData.代码是

I work about opencv in visual studio 2008

I access imageData of grayscale image. The code is

int step = tempimage->widthStep;
uchar * data = (uchar *)tempimage->imageData;
if( (x+y*step+1+step)<(width+height*step) ){
        if( int(data[x+y*step+1+step])==0 )
            count++;
    }


但有错误

编译器告诉数据值255''.'',然后键入unsigned

请帮我解决这个问题

谢谢.

-从OP更新-
错误的屏幕截图
http://img684.imageshack.us/i/cpopencvinvisualstudio2.png/ [


but it have error

compiler tell data have value 255''.'' and type unsigned

please help me how to solve this problem

thank.

-- update from OP --
Screenshot of error
http://img684.imageshack.us/i/cpopencvinvisualstudio2.png/[^]
(moved to Imageshack)
--

推荐答案

这是我的错误

http://www.tempf.com/getfile.php?id=845750&key=4d45a68e613af

This is my bug

http://www.tempf.com/getfile.php?id=845750&key=4d45a68e613af




[url=http://www.tempf.com/getfile.php?id=845750&key=4d45a68e613af]http://www.tempf.com/getfile.php?id=845750&key=4d45a68e613af[/url]

how to solve this problem


这可能是因为您正在读取数组data[]超出其长度.在这种情况下,值 255 没有任何意义,只是一些数据恰好位于数组末尾的内存中.检查分配的长度以及发生错误时的数组索引.
That is probably because you are reading the array data[] beyond its length. In this case, the value 255 has no meaning, it is just some data that happens to be in the memory beyond the end of the array. Check the allocated length, and the array index when the error occurs.


这篇关于Visual Studio 2008中的OpenCV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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