Test 1:
BITMAP* input; //bitmap containing image data
Mat _image(height, width, CV_8UC4, input); //convert Bitmap to Mat
imwrite("0.jpg",_image); //write out the original input image
Mat image = imread("0.jpg"); //read it back to a new Mat
imwrite("1.jpg",image); //checkpoint 1
Mat image_remapped(Size(width, height), image.type(), Scalar(0,0,0,255)); //initialize another Mat
imwrite("2.jpg",image); //checkpoint 2
Both 1.jpg and 2.jpg were the same as input. It does make sense. However, there should be something wrong with the Test 2.
----------
Test 2:
BITMAP* input; //bitmap containing image data
Mat image(height, width, CV_8UC4, input); //convert Bitmap to Mat
imwrite("1.jpg",image); //checkpoint 1
Mat image_remapped(Size(width, height), image.type(), Scalar(0,0,0,255)); //initialize another Mat
imwrite("2.jpg",image); //checkpoint 2
The output 1.jpg was the same as input image, 2.jpg was total black.
I'm confused by the case 2. Why the `Mat image` was overwritten by the new `Mat image_remapped`?
↧