【发布时间】:2022-03-21 23:46:47
【问题描述】:
我正在使用这些代码将 Mat 图像编码为 .jpg 格式。它适用于小图像,但是当我放置大图像时,项目会出现异常
0x76377fb2 (ucrtbase.dll) 中的未处理异常 ImageRecognition.exe:0xC0000409:0xc0000409。
我在 Visual Studio 2015 中使用 opencv2.4.12,我的操作系统是 Windows 10,这是我的代码块。
cv::threshold(image, image, 100, 255, cv::THRESH_BINARY + cv::THRESH_OTSU);
std::vector<uchar> buf;
imencode(".jpg", image, buf);
【问题讨论】:
-
确保
image是8U或16U,具有1 个或3 个通道。否则将无法正常工作。