Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi guys thanks for your replies.

Michael, below is the exact code I am using (GCC 4.7.2, OpenCV 2.4.5) but when I change the last parameter in the Mat declaration from 001 to 0 or 000 etc. the program compiles fine but generates the following runtime error (Why is this?):

OpenCV Error: Null pointer (The matrix has NULL data pointer) in cvGetMat, file /home/dme/Documents/opencv-2.4.5/modules/core/src/array.cpp, line 2387 terminate called after throwing an instance of 'cv::Exception' what(): /home/dme/Documents/opencv-2.4.5/modules/core/src/array.cpp:2387: error: (-27) The matrix has NULL data pointer in function cvGetMat

include <opencv2 core="" core.hpp="">

#include <opencv2/highgui/highgui.hpp>
#include <iostream>

using namespace std;
using namespace cv;

int main()
{
    Mat blackImage(200, 200, CV_8U, 001);

    namedWindow("Black");
    imshow("Black", blackImage);

waitKey(0);
}

Hi guys thanks for your replies.

Michael, below is the exact code I am using (GCC 4.7.2, OpenCV 2.4.5) but when I change the last parameter in the Mat declaration from 001 to 0 or 000 etc. etc to represent black, the program compiles fine but generates the following runtime error (Why is this?):

OpenCV Error: Null pointer (The matrix has NULL data pointer) in cvGetMat, file /home/dme/Documents/opencv-2.4.5/modules/core/src/array.cpp, line 2387 terminate called after throwing an instance of 'cv::Exception' what(): /home/dme/Documents/opencv-2.4.5/modules/core/src/array.cpp:2387: error: (-27) The matrix has NULL data pointer in function cvGetMat

include

#include <opencv2 core="" core.hpp="">

core.hpp=""> #include <opencv2 highgui="" highgui.hpp=""> #include <iostream>

#include <opencv2/highgui/highgui.hpp>
#include <iostream>

using namespace std;
using namespace cv;

int main()
{
    Mat blackImage(200, 200, CV_8U, 001);

    namedWindow("Black");
    imshow("Black", blackImage);

waitKey(0);
}