opencv 错误中的(自适应)阈值(cvarrToMat 中的错误参数(未知数组类型))
我试图在我的视频流上使用阈值,但它不起作用。
我的视频流:
Mat *depthImage = new Mat(480, 640, CV_8UC1, Scalar::all(0));
然后我尝试进行自适应阈值处理(也不适用于常规阈值处理)
for(;;){
if( wrapper->update()){
wrapper->getDisplayDepth(depthImage);
cvAdaptiveThreshold(depthImage, depthImage,255,CV_ADAPTIVE_THRESH_MEAN_C, CV_THRESH_BINARY,75,10);
imshow("Depth", *depthImage);
}
int k = waitKey(25);
if(k == 27 ) exit(0);
}
我收到此错误:
OpenCV 错误:cvarrToMat 中的错误参数(未知数组类型),文件 /Users/olivierjanssens/source/OpenCV-2.3.1/modules/core/src/matrix.cpp,第 646 行 终止调用抛出异常
我做错了什么,我可以完美地显示并看到流。但是当我添加这个阈值时,我得到了前面提到的错误。 (顺便说一句,我对 opencv 相当陌生)。
提前谢谢!
I'm trying to use thresholding on my video stream but it is not working.
My video stream:
Mat *depthImage = new Mat(480, 640, CV_8UC1, Scalar::all(0));
Then i try to do the adaptive thresholding, (also doesn't work with regular thresholding)
for(;;){
if( wrapper->update()){
wrapper->getDisplayDepth(depthImage);
cvAdaptiveThreshold(depthImage, depthImage,255,CV_ADAPTIVE_THRESH_MEAN_C, CV_THRESH_BINARY,75,10);
imshow("Depth", *depthImage);
}
int k = waitKey(25);
if(k == 27 ) exit(0);
}
I get this error :
OpenCV Error: Bad argument (Unknown array type) in cvarrToMat, file /Users/olivierjanssens/source/OpenCV-2.3.1/modules/core/src/matrix.cpp, line 646
terminate called throwing an exception
What am i doing wrong, i can get display and see the stream perfectly.But when i add this thresholding i get the error previously mentioned. (i'm rather new to opencv btw).
Thx in advance !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的 heightImage 是一个指向 cv::Mat 的指针,这对我来说似乎很奇怪......
但是,如果你使用 C++ 语法,那么你会想要使用 C++ 版本的adaptiveThreshold,它处理
cv::Mat
,具有以下定义:如果您尚未使用该命名空间,则需要以
cv::
为前缀。例如:
Your depthImage is a pointer to a cv::Mat, which to me seems strange...
...but, if you're using the C++ syntax then you'll want to use the C++ version of adaptiveThreshold, which deals with
cv::Mat
, with the following definition:which will need prefixed by
cv::
if you're not using that namespace already.For example: