Fastest way to apply color matrix to RGB image using OpenCV 3.0?

后端 未结 2 852
栀梦
栀梦 2020-12-18 06:43

I have a color image represented as an OpenCV Mat object (C++, image type CV_32FC3). I have a color correction matrix that I want to apply to each pixel of the RGB color im

2条回答
  •  余生分开走
    2020-12-18 07:31

    Basically the linked answer uses reshape to convert your CV_32FC3 mat of size m x n to a CV_32F mat of size (mn) x 3. After that, each row of the matrix contains exactly color channels of one pixel. You can then apply usual matrix multiplication to obtain a new mat and reshape it back to the original shape with three channels.

    Note: It may be worth noticing that the default color space of opencv is BGR, not RGB.

提交回复
热议问题