2016-11-28 122 views

回答

0

您可以使用垫的分割。

例如,在BGR图片(我会告诉你在C++中,因为我没那么到opencv4Android):

cv::Mat src = cv::imread("some.png"); 
cv::Mat planes[3]; 
cv::split(src, planes); 

如果你有一个BGR你现在将有R-飞机在planes[2]

另一种可能性是,刚刚拿到飞机缓冲区例如(Java的Android现在):

/* Get your Image somehow */ 
Image.Plane Y = img.getPlanes[0]; 
Image.Plane U = img.getPlanes[1]; 
Image.Plane V = img.getPlanes[2]; 

//now just for Y e.g. 
ByteBuffer yBuffer = Y.getBuffer(); 
byte[] yBytes = new Byte[yBuffer.remaining()]; 
yBuffer.get(yBytes); 

//read the byte data into a cv::Mat