# Revision history [back]

use counter.at<uchar>(j,i) would be slowly, try use

(faster) do something scanline-like scan

    for (int i = 0; i < W.cols; i++)
{
*uchar data=counter.ptr(i);

for (int j = 0; j < W.rows; j++)
{
//do something with data[j];
}
}


or

(fastest) if your mat is continuous you can treat it as 1-d array

uchar* data = (uchar*) counter.data; for(int i=0; i< counter.cols* counter.rows;i++) {
//do something with data[i];


}

use counter.at<uchar>(j,i) would be slowly, try use

(faster) do something scanline-like scan

    for (int i = 0; i < W.cols; i++)
W.rows; i++)  //row first!
{
*uchar data=counter.ptr(i);

for (int j = 0; j < W.rows; W.cols; j++)
{
//do something with data[j];
}
}


or

(fastest) if your mat is continuous you can treat it as 1-d array

uchar* data = (uchar*) counter.data; for(int i=0; i< counter.cols* counter.rows;i++) {
//do something with data[i];


}

use counter.at<uchar>(j,i) would be slowly, try use

(faster) do something scanline-like scan

    for (int i = 0; i < W.rows; i++)  //row first!
{
*uchar data=counter.ptr(i);
data=W.ptr(i);

for (int j = 0; j < W.cols; j++)
{
//do something with data[j];
}
}


or

(fastest) if your mat is continuous you can treat it as 1-d array

uchar* data = (uchar*) counter.data; W.data; for(int i=0; i< counter.cols* counter.rows;i++) W.cols*W.rows;i++) {
//do something with data[i];


}

use counter.at<uchar>(j,i) would be slowly, try use

(faster) do something scanline-like scan

    for (int i = 0; i < W.rows; i++)  //row first!
{
*uchar data=W.ptr(i);

for (int j = 0; j < W.cols; j++)
{
//do something with data[j];
}
}


or

(fastest) if your mat is continuous you can treat it as 1-d array

uchar* data = (uchar*) W.data; W.data;


for(int i=0; i< W.cols*W.rows;i++) { //do something with data[i]; data[i];

}

use counter.at<uchar>(j,i) would be slowly, try use

(faster) do something scanline-like scan

    for (int i = 0; i < W.rows; i++)  //row first!
{
*uchar data=W.ptr(i);

for (int j = 0; j < W.cols; j++)
{
//do something with data[j];
}
}


or

(fastest) if your mat is continuous you can treat it as 1-d array

 uchar* data = (uchar*) W.data;

W.data;

for(int i=0; i< W.cols*W.rows;i++) { //do something with data[i]; }

}

use counter.at<uchar>(j,i) would be slowly, try use

(faster) do something scanline-like scan

    for (int i = 0; i < W.rows; i++)  //row first!
{
*uchar data=W.ptr(i);

for (int j = 0; j < W.cols; j++)
{
//do something with data[j];
}
}


or

(fastest) if your mat is continuous you can treat it as 1-d array

 uchar* data = (uchar*) W.data;

for(int i=0; i< W.cols*W.rows;i++)
{
//do something with data[i];
}


use counter.at<uchar>(j,i) .at<uchar>(j,i) would be slowly, try use

(faster) do something scanline-like scan

    for (int i = 0; i < W.rows; i++)  //row first!
{
*uchar data=W.ptr(i);

for (int j = 0; j < W.cols; j++)
{
//do something with data[j];
}
}


or

(fastest) if your mat is continuous you can treat it as 1-d array

uchar* data = (uchar*) W.data;

for(int i=0; i< W.cols*W.rows;i++)
{
//do something with data[i];
}