Creating a simple black image with opencv using cvcreateimage

image, opencv

Solution

What version of opencv you are using? For Mat,

#include <opencv2/opencv.hpp>
cv::Mat image(320, 240, CV_8UC3, cv::Scalar(0, 0, 0));

Problem

Very basic question coming from a newbie in OpenCV. I just want to create an image with every pixel set to `0` (black). I have used the following code in the main() function: ``` IplImage* imgScribble = cvCreateImage(cvSize(320, 240), 8, 3); ``` And what I get is a solid gray image, instead of the black one. Thanks in advance !

Original source