How can I get the pixel's value in an binary image in c++?

asked 2018-06-22 17:14:19 -0500

I know that I have to use imaginary.at<uchar>(i,j); but in my code its doesn't work . I want to do that my code identifies when the pixels value is 1 or 0 .

for(i=1;i<binaria.rows;i++){
    for(j=1; j<binaria.cols; j++){
        if( binaria.at<uchar>(i,j)==1){
            cv::imshow("Binaria", binaria);

        }

    }
}
edit retag flag offensive close merge delete

Comments

can you tell us, what you are trying to achieve here ? what is the purpose of it ?

berak gravatar imageberak ( 2018-06-22 19:25:00 -0500 )edit

i have an binary image and I´m trying cut this image where the pixels 1 are the important . my intention is verified that pixel is 1 or 0 and cut the image keeping in the image result the image where the pixels 1 predominated.

BiancaDSM gravatar imageBiancaDSM ( 2018-06-25 11:02:26 -0500 )edit