Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

how to add each pixel of mat in android

hi, how can i add each pixel of a matrix in a loop in android

below is my c++ code :

for(int x=0;x<=4;x++) { for(int y=0;y<=4;y++) { sum1=sum1+ block.at<uchar>(x, y); // Addition of all elements sum2=sum2+block.at<uchar>(x,y)*block.at<uchar>(x,y); //Addition of all element square
} }

where block is a 5x5 mat

click to hide/show revision 2
No.2 Revision

how to add each pixel of mat in android

hi, how can i add each pixel of a matrix in a loop in android

below is my c++ code :

for(int x=0;x<=4;x++)
{
    for(int y=0;y<=4;y++)
    {
    sum1=sum1+ block.at<uchar>(x, y);  // Addition of all elements
    sum2=sum2+block.at<uchar>(x,y)*block.at<uchar>(x,y); //Addition of all element square 
} }

}

where block is a 5x5 mat