Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

distribution of color in 3d coordinates and diagonal of bounding box

As the title says I want to find the diagonal of bounding box of the ab-plane from an RGB to CIELab transformed image. I am not really sure how to achieve this but my fist idea is to get the distribution of color in 3d coordinates (how do I get that in 3d coordinates?) and then get a bounding box of that distribution from where I can extract the length of the diagonal (I don't know can I visualize this afterwards with the viz module, not that important though). Does anyone have any experience how to achieve that? Should I use histogram, EM (expectation maximization) and estimate color distribution with a gaussian mixture model, or to play with something simple like to find the mean and standard deviation of each channel? I searched a bit in the net but I couldn't find something straight forward.

//Load the images
Mat src = imread("image.png");

//Convert to Lab space and CV_32F1
Mat lab;
cvtColor(src, lab, COLOR_BGR2Lab );

lab.convertTo(src_lab,CV_32FC1);

// Split into individual channels
vector<Mat> channels;
split( lab, channels );

then what.....?