Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Count black pixel each column manual

Hi guys, i have already counted black pixel from binary image using countNonZero function. And i was curious to implement it manually. Here is my code to count black pixel on each column :

for(int aa = 0; aa < after_shear.cols;aa++){
    Mat aaTmp = after_shear.col(aa);
    int  jumlah = 0;
    for(int oalah = 0; oalah < aaTmp.rows;oalah++){
      for(int oalah2 = 0; oalah2<aaTmp.cols;oalah2++){
        //cout <<(int)<uchar>(oalah,oalah2)<<endl;


But, it gives me zero result.

Can anyone help me ? Thanks