[Solved] How can I access each pixel in OpenCV, perform an operation and return the new information to the image?


I think that this code you could use

 int nl= image.rows; 
 int nc= image.cols * image.channels();
 for (int j=0; j<nl; j++) {
    uchar* data= image.ptr<uchar>(j);
    for (int i=0; i<nc; i++) {
       data[i]= data[i]/div*div + div/2;
    }
 }

solved How can I access each pixel in OpenCV, perform an operation and return the new information to the image?