Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

WHY ARE SPLIT MATS NOT CONTINOUS

so I split an into is seperate colors (using split on the matrix). When I then try to reshape one of the resulting matrix I get the following error:

OpenCV Error: Image step is wrong (The matrix is not continuous, thus its number of rows can not be changed) in reshape, file /tmp/opencv3-20160429-9997-hdwo4d/opencv-3.1.0/modules/core/src/matrix.cpp, line 997

so then I quickly wrote the following code:

cv::Mat image = cv::imread(inputImageName,CV_LOAD_IMAGE_COLOR);
cv::Mat colorMats[3];
cv::split(image,colorMats);
for (int i=0;i < 3;++i)
{
    std::cout<<colorMats[i].isContinuous()<<std::endl;
}

and got the following result

1
1
0

why is the last one not continuous ?