c++ - Threshoding image between certain range -
how threshold image between range? have done doesn't work.
for (int i=0;i<s.size().height;i++) { for(int j=0;j<s.size().width;j++) { int k=int (s.at<uchar>(j,i)); if (k>6 && k<10) k=255; else k=0; s.at<uchar>(j,i)=k; } }
you uchar value, , convert integer. try :
uchar k= s.at<uchar>(j,i); if (k>6 && k<10) { k=255; }else { k=0; } s.at<uchar>(j,i)=k;
i think may work.
Comments
Post a Comment