Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

your cv::Mat image was never initialized, so you can't write any data to it.

imho, you need something like this:

//let's make an all black drawing image
Mat image(480, 640, CV_8UC3, Scalar::all(0)); // should be the size of the original image, but idk that !

Vec3b color(140,160,160); // desired point color

for (p : points) {
      image.at<Vec3b>(p) = color; // you can use Mat::at with a Point !      
}

your cv::Mat image was never initialized, so you can't write any data to it.

imho, you need something like this:

//let's make an all black drawing image
Mat image(480, 640, CV_8UC3, Scalar::all(0)); // should be the size of the original image, but idk that !
image

Vec3b color(140,160,160); // desired point color

for (p : points) {
      image.at<Vec3b>(p) = color; // you can use Mat::at with a Point !      
}

your cv::Mat image was never initialized, so before you can't write any data can draw something into it, you need to it.allocate memory for the pixels

imho, you need something like this:

//let's make an all black drawing image
Mat image(480, 640, CV_8UC3, Scalar::all(0)); // should be the size of the original image

Vec3b color(140,160,160); // desired point color

for (p : points) {
      image.at<Vec3b>(p) = color; // you can use Mat::at with a Point !      
}

your cv::Mat image was never initialized, before you can draw something into it, you need to allocate memory for the pixels

imho, you need something like this:

//let's make an all black drawing image
Mat cv::Mat image(480, 640, CV_8UC3, Scalar::all(0)); cv::Scalar::all(0)); // should be the size of the original image

Vec3b cv::Vec3b color(140,160,160); // desired point color

for (p : points) {
      image.at<Vec3b>(p) image.at<cv::Vec3b>(p) = color; // you can use Mat::at with a Point !      
}