Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to store points cordinats

hi,

I'm new in openCV and c++ and I am stuck at one problem.

For now I would like to make program which will store centerpoints coordinates (x,y) of white blob and then after that draw straight line through them.

This code will calculate center of every white segment per column (po)

for (j = 0; j < slikica.cols; j++) {

    for (i = 0; i < slikica.rows; i++) {

        if (slikica.at<uchar>(i,j) == 255) {
            tc = tc + i;
            stup = stup + 1;
            po = tc / stup;


            //HERE I NEED TO STORE  POINT (po,j)//

br = br + 1;

        }
    }
}

This is my picture and red line is what i'm looking for. picture

Thanks