the source image has been shown, but can not to resize the image and exit the application.
please post code as text
There is my code
int imgWidth = 320;
int imgHeight = 240;
uint8_t *imgBuf = nullptr;
cv::Mat srcImg, dstImg;
uint8_t *buf = new uint8_t[imgWidth * imgHeight];
imgBuf = buf;
for (int i = 0; i < imgHeight; i++) {
for (int j = 0; j < imgWidth; j++) {
uint8_t data = rand() % 256;
buf[i * imgWidth + j] = data;
}
}
srcImg = cv::Mat(imgHeight, imgWidth, CV_8UC1, imgBuf);
cv::imshow("srcImg", srcImg);
if (!srcImg.empty()) {
int newImgWidth = imgWidth * 2;
int newImgHeight = imgHeight * 2;
cv::resize(srcImg, dstImg, cv::Size(newImgWidth, newImgHeight), 0, 0, cv::INTER_NEAREST);
}
if (!dstImg.empty()) {
cv::imshow("dstImg", dstImg);
cv::waitKey(0);
}
you are mixing GUI toolkits: Qt and whatever opencv was built with.
that is dangerous and likely the cause of all issues you experience.
as long as there is any Qt involved, we can’t help.
I got it, this question come from the opencv configure problem in qt .pro file
There is no problem with win32ui check :
cout << srcImg.rows << "," << srcImg.cols << "\n";
cout << dstImg.rows << "," << dstImg.cols << "\n";
You can use rng::fill instead of rnd
Thank you for your help, I had fixed it.