Ask Your Question

Revision history [back]

I'm not sure of what you want to do, but if you want to compute an histogram per line (or group of lines), I suggest using the ROI and [calcHist](http://docs.opencv.org/modules/imgproc/doc/histograms.html?highlight=calchist#void calcHist(const Mat* images, int nimages, const int* channels, InputArray mask, OutputArray hist, int dims, const int* histSize, const float** ranges, bool uniform, bool accumulate) function:

cv::Mat img = imread( "myimage", 0 ); // Read in grayscale
int rows = img.rows;
int cols = img.cols;
const int step = 3; // Size of your window (3x3,...)
for( int r = 1 ; r < rows ; ++r )
{
    cv::Mat roi = img(cv::Rect(r,0,step,cols));
    cv::calcHist( &img, 1, channels, cv::Mat(), hist, 1, histSize, ranges );
    // Do what you whant with your histogram (equilization, save, ...)
}

I haven't specify all the parameters of calcHist, read the doc for all information you may needed (and the sample below the function is very useful!).