Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Problem related to image pixel draw in .png format

I have 6 images with 256 by 256 dimension. I want to draw only first image with dimension 100 by 100. Here in my code segment. I tried in following way but failed to draw. How can i do this?

int main(..)
{
............................
 cv::Mat image[6] = cv::Mat::zeros(256, 256, CV_8U);

  for (int i = 0; i < 6; i++) {
    rasterizer.rasterize_depthbuffer(mesh, image[i], i, true);
    std::ostringstream stream;
    stream << i;
    std::string count = stream.str();
    cv::imwrite("image/test" + count + ".png", image[i]);
  }

   for (int y = 0; y < 100; y++) {
      for (int x = 0; x < 100; x++) {
       cv::imwrite("image/test.png", image[0].at<double>(y, x));
      }
    }

}