使用cvGet2D函数 - opencv [英] Using cvGet2D function - opencv
本文介绍了使用cvGet2D函数 - opencv的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Helo,
我不知道错误在哪里/我认为它与cvGet2D函数有关但在哪里错了?
Helo, I dont know where is error/ I think it is connected with cvGet2D function but where is sth wrong??
IplImage *img = cvLoadImage("car1.jpg",0);
CvScalar s;
for(int i=0;i<img->height;i++)
{
for(int j=0;j<img->width;j++)
{
s = cvGet2D(img,i,j);
}
}
一段时间后有信息进程返回-1073741819< 0xC0000005>
After some time there is info Process returned -1073741819 <0xC0000005>
推荐答案
因为你显然是opencv的新手,拜托,你必须使用它的c ++ api,而不是弃用的c-one。
since you're obviously new to opencv, please, you must use it's c++ api, not the deprecated c-one.
cv::Mat img = cv::imread("car1.jpg", 0); // this will read a grayscale - 1channel image.
if ( img.empty() )
{
// whaa, file not found
return -1;
}
for(int i=0; i<img.rows; i++)
{
for(int j=0; j<img.cols; j++)
{
uchar s = img.at<uchar>(i,j);
}
}
这篇关于使用cvGet2D函数 - opencv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文