如何确定一个cv :: Mat是一个零矩阵? [英] How to determine if a cv::Mat is a zero matrix?
本文介绍了如何确定一个cv :: Mat是一个零矩阵?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个根据以下代码动态更改的矩阵:
I have a matrix that is dynamically being changed according to the following code;
for( It=all_frames.begin(); It != all_frames.end(); ++It)
{
ItTemp = *It;
subtract(ItTemp, Base, NewData);
cout << "The size of the new data for ";
cout << " is \n" << NewData.rows << "x" << NewData.cols << endl;
cout << "The New Data is: \n" << NewData << endl << endl;
NewData_Vector.push_back(NewData.clone());
}
我想要做的是确定cv :: Mat NewData是一个零矩阵。
我尝试过使用cv :: compare()函数和简单的运算符(即NewData == NoData)将它与零大小的矩阵进行比较,但是我甚至不能编译程序。
What I want to do is determine the frames at which the cv::Mat NewData is a zero matrix. I've tried comparing it to a zero matrix that is of the same size, using both the cv::compare() function and simple operators (i.e NewData == NoData), but I can't even compile the program.
有一个简单的方法来确定cv :: Mat是由零填充的吗?
Is there a simple way of determining when a cv::Mat is populated by zeroes?
推荐答案
我使用了
if (countNonZero(NewData) < 1)
{
cout << "Eye contact occurs in this frame" << endl;
}
这是一个非常简单
这篇关于如何确定一个cv :: Mat是一个零矩阵?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文