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)fuckTmp.at<uchar>(oalah,oalah2)<<endl;
if((int)aaTmp.at<uchar>(oalah,oalah2)==0){
jumlah++;
}
}
}
if(jumlah==0||jumlah==1){
pspArray2.push_back(fuck2);
}
}
But, it gives me zero result.
Can anyone help me ? Thanks