C++ 的opencv;
我想要显示一个CV_32SC1格式的全黑画面,结果总是报错,把CV_32SC1换成CV_8UC1就正常显示了,请问是什么原因?
这是可以正常显示的
#include<opencv2/opencv.hpp>
#include<iostream>
using namespace cv;
using namespace std;
int main() {
Mat src = imread("C:/Users/zhufu/Pictures/Saved Pictures/face.jpg");
if (src.empty()) {
printf("could not load image...\n");
return -1;
}
namedWindow("input image", WINDOW_AUTOSIZE);
imshow("input image", src);
![img](https://img-mid.csdnimg.cn/release/static/image/mid/ask/439436949296182.png "#left")
Mat img(Size(358, 441), CV_8UC1, Scalar(0));
namedWindow("Black Image", WINDOW_NORMAL); //
imshow("Black Image", img);
waitKey(0);
return 0;
}
这是无法显示的
#include<opencv2/opencv.hpp>
#include<iostream>
using namespace cv;
using namespace std;
int main() {
Mat src = imread("C:/Users/zhufu/Pictures/Saved Pictures/face.jpg");
if (src.empty()) {
printf("could not load image...\n");
return -1;
}
namedWindow("input image", WINDOW_AUTOSIZE);
imshow("input image", src);
Mat img(Size(358, 441), CV_32SC1, Scalar(0));
namedWindow("Black Image", WINDOW_NORMAL); //
imshow("Black Image", img);
waitKey(0);
return 0;
}
![img](https://img-mid.csdnimg.cn/release/static/image/mid/ask/764957949296116.jpg "#left")