Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 什么是';!image.data';以C+表示的平均值+;?_C++_Opencv - Fatal编程技术网

C++ 什么是';!image.data';以C+表示的平均值+;?

C++ 什么是';!image.data';以C+表示的平均值+;?,c++,opencv,C++,Opencv,我是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::en

我是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;
}
Mat图像;
image=imread(文件名,imread_颜色);//读文件
if(!image.data)//检查输入是否无效
{

cout
cv::Mat::data
是指向由
cv::Mat
对象在内部保存的数据缓冲区的指针。如果其计算结果为false,则表示未加载任何数据,并且无法取消引用指针


这相当于在C++11中将
图像。数据
NULL
0
nullptr
进行比较。

cv::Mat::data
是指向
cv::Mat
对象内部保存的数据缓冲区的指针。如果其计算结果为false,则表示未加载任何数据,且指针无法反引用土木工程署


这相当于将
image.data
与C++11中的
NULL
0
nullptr
进行比较。

对不起,我不熟悉格式。请忽略每行末尾的“
”:)它与
if(NULL==image.data)的操作相同看起来你也是C++初学者。这是<>代码> ./COD>成员访问运算符和<代码> <代码>逻辑否定操作符(测试成员是否为空指针)的直接用法。阅读一本好的C++书籍。我们有和任何一种对NULL值的检查一样的东西。抱歉,我不熟悉格式。请忽略每行末尾的“
”。看起来你也是C++初学者。这是使用代码< >代码>成员访问操作符和<代码> <代码>逻辑否定操作符(测试成员是否为空指针)。读一本好的C++书。我们有和任何一种null值的检查一样的东西。