I am looking for an efficient way for editing/reading pixels from Mat (or Mat3b) variable.
I have used :-
Image.at<Vec3b>(i,j)
but it seems to be very slow.
I also used this:-
A.data[A.channels()*A.cols*i + j + 0]
but the problem I am facing with this is when I run this loop
for(i=0; j<A.rows; i++){
for(j=0; j<A.cols; j++){
A.data[A.channels()*A.cols*i + j + 0] = 0;
A.data[A.channels()*A.cols*i + j + 1] = 0;
A.data[A.channels()*A.cols*i + j + 2] = 0;
}
}
only a portion of image is blackened.
See Question&Answers more detail:os