Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Swapping the two for loops should work:

for (int x=0;x< frame_gray.cols;x+=1){
    for( int y=0; y< frame_gray.rows; y++){
        cout<<"pixel at X="<<x<<" and y="<<y<<" is: "<<<uchar>(y,x);
        if (<uchar>(y,x)==0)
        {  cout << " (black)" << endl;}

        {  cout << " (white)" << endl;}


    cout << "new pixel column: "<<x << endl;

In the meantime, as long as it's possible, you should use line-by-line processing and line pointers. It's faster than direct element access with<type>(y,x).