0
有无论如何创建3个mat对象来保存YUV_420_888平面数据。 一个用于Y,另一个用于U,最后一个用于V平面。OpenCV从YUV_420_888平面创建3个mat对象
我不想将它们转换为BGR或其他任何东西,只要按上述方法保存数据即可。
有无论如何创建3个mat对象来保存YUV_420_888平面数据。 一个用于Y,另一个用于U,最后一个用于V平面。OpenCV从YUV_420_888平面创建3个mat对象
我不想将它们转换为BGR或其他任何东西,只要按上述方法保存数据即可。
您可以使用垫的分割。
例如,在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