I had a problem while splitting rgb image into single channels. My simple code is as following
**cv::Mat src = cv::imread("D:/Test/a.jpg", 1);
std::vector<cv::Mat> img_rgb;
cv::split(src, img_rgb);
cv::imshow("a", src);**
My debug shows that this probem come from the split function and the following errors was throwed. *Unhandled exception at 0x10005768 in Test_Opencv2.4.1.exe: 0xC0000005: Access violation reading location 0x000000bc.*
Does anyone know how to solve this problem? Thanks in advance!
You might have to use the other slash and escape it, plus you always need to check the return of imread()
:
cv::Mat src = cv::imread("D:\\Test\\a.jpg", 1);
if (src.empty())
{
std::cout << "!!! Couldn't load image" << endl;
// exit
}
User contributions licensed under CC BY-SA 3.0