From an image to his components. [closed]

asked 2013-11-20 13:40:53 -0600

residentelvio gravatar image

updated 2013-11-20 14:00:14 -0600

berak gravatar image

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

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-10-07 18:56:02.998981

Comments

1

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.

berak gravatar imageberak ( 2013-11-20 13:59:21 -0600 )edit

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

berak gravatar imageberak ( 2013-11-20 14:00:45 -0600 )edit

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

residentelvio gravatar imageresidentelvio ( 2013-11-21 10:52:25 -0600 )edit

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

   Decorr=colorDecorrelation(inComp,numColComp); //decorrelation (ok) 
   rgbDecorr= reshape(Decorr, r, c, numColComp);
   [imfft,sz2filt,padSize]=FourierTransform2D(rgbDecorr(:,:,1),achrLambda_max); //take 1st component
   ....
residentelvio gravatar imageresidentelvio ( 2013-11-23 04:47:42 -0600 )edit