Convert 12-bit Bayer image to 8-bit RGB using OpenCV
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to use OpenCV 2.3.1 to convert a 12-bit Bayer image to an 8-bit RGB image. This seems like it should be fairly straightforward using the cvCvtColor function, but the function throws an exception when I call it with this code: int cvType = CV_MAKETYPE(CV_16U, 1); cv::Mat bayerSource(height, width, cvType, sourceBuffer); cv::Mat rgbDest(height, width, CV_8UC3); cvCvtColor(&bayerSource, &rgbDest, CV_BayerBG2RGB); I thought that I was running past the end of sourceBuffer, since the input data is 12-bit, and I had to pass in a 16-bit