How to split cv2.imread to 3 separate mats
it is a newbie question, please, what's wrong with this code:
import cv2
import cv2.cv as cv
img = cv2.imread(fn)
cvImg = cv.fromarray(img)
#~ rgba = cv.CreateMat(cvImg.width, cvImg.height , cv.CV_8UC4)
sb = cv.CreateMat(cvImg.width, cvImg.height , cv.CV_8UC1)
sg = cv.CreateMat(cvImg.width, cvImg.height , cv.CV_8UC1)
sr = cv.CreateMat(cvImg.width, cvImg.height , cv.CV_8UC1)
sa = cv.CreateMat(cvImg.width, cvImg.height , cv.CV_8UC1)
cv.Split(cvImg,sb,sg,sr,sa)
"""
Traceback (most recent call last):
File "squares2.py", line 188, in <module>
cv.Split(cvImg,sb,sg,sr,sa)
cv2.error: dvec[j].size() == src.size()
"""