I am using these codes for encode Mat image to .jpg format. It is working with small images, but when I put a large image, project give exception
Unhandled exception at 0x76377fb2 (ucrtbase.dll) in ImageRecognition.exe: 0xC0000409: 0xc0000409.
I am using opencv2.4.12 in Visual Studio 2015 and my OS is Windows 10 here is my code block.
cv::threshold(image, image, 100, 255, cv::THRESH_BINARY + cv::THRESH_OTSU);
cv::vector<uchar> buf;
imencode(".jpg", image, buf);