# From an image to his components.

I have an image decorrelated and I need to obtain reshaping it 3 components: the first is achromatic and others 2 chromatic. So this decorrelated image(Mat) has to be reshaped as a matrix made as rows-by-cols-by-channels. But I can not use reshape function of OpenCv, because it s just for 2D matrix. How can I solve it? After this I need to pass the 3 different components to some function, so it s important I can use it

could you explain 'chromatic' and 'achromatic' ?

is it a question of 'color models' ?

YCrCb sems to fit your description ( 1 'luminance' channel, 2 'chroma' ones)

cv::reshape() just changes rows/cols, not the underlying data model.

btw, what's 'ime' supposed to be ?

Ok so what I do in the start of my project is :

To load an image and to decorrelate his RGB components to obtain an efficient decodification of datas thanks to PCA analysis adapted to local statistics of image. After this decorrelation of color I need to obtain 3 components of the initial image by reshaping it in a 3dimensional matrix made by rows by cols by channels. It s like I have three different picture(r-g-b) and I have to use it separately. So after decorrelation I obtain a new matrix of the image (decorrelated) . So I have to obtain the 3 components of first image to use it separetely after that

What I need is this Matlab's code in C++