什么'!图像数据"在C++中的意思?
What does '! image.data' mean in C++?
我是使用OpenCV和Visual Studio进行图像处理的初学者。我有一段不懂的代码:
Mat image;
image = imread(filename, IMREAD_COLOR); // Read the file
if (! image.data ) // Check for invalid input
{
cout << "Could not open or find the image" << std::endl ;
return -1;
}
第三行,!
和.data
是什么意思?他们如何检查无效输入?
cv::Mat::data
是指向cv::Mat
对象内部保存的数据缓冲区的指针。如果它的计算结果为false,则表示没有加载数据,并且不能取消对指针的引用。
它相当于c++ 11中image.data
与NULL
、0
或nullptr
的比较。
相关文章:
- 这个语法std::class<>{}(arg1, arg2) 在C++中是什么意思?
- 标准 N3337 5.2.10 第 7 条中的C++"类型"是什么意思?
- "类模板示例<int>;"语句对 C++11 是什么意思?
- 线应该是什么意思
- 错误:无效的预处理指令 #i 的意思是 #if?
- "CID"在AT+HTTPPARA= "CID" ,1中是什么意思
- 表达式"b=(b-x)&x"是什么意思?
- 这个表达是什么意思?
- 此代码验证公式是什么意思?
- 跟踪日志中的T.11803()是什么意思?
- Trie*& 和 Trie** 的意思是 Same?
- 这个额外的关键字在这个 c++ 类声明中是什么意思?
- 错误:无法解析对重载函数的引用;你的意思是调用它吗?
- * 和 ** 在 C++ 函数声明中是什么意思?
- _T("xyz")是什么意思?
- #define Dbg(fmt,..) (0) 是什么意思? 警告:表达式无效
- 这行代码到底是什么意思?
- 在命名空间名称之前加上 :: 是什么意思?
- 从字符数组的元素中减去'a'是什么意思
- "friend"关键字在C++中是什么意思?