Reputation: 43
I'm new to the c++ interface and running out of ideas about this code:
//buffer : VideoCapture >> cvtColor >> Canny
for(int i=0;i<buffer.rows;i++) //search for edges
{
for (int j=0 ;j<buffer.cols;j++)
{
Vec3b pixel=buffer.at<Vec3b>(i,j);
}
}
runs fine in debug mode but crashing at some point (i=479, j=448) in release.(oh and can't catch any exception... of course...)
but
Vec3b pixel=buffer.at<Vec3b>(1,1000);
works in elease even if my image(buffer) is 640*480.
I think i am missing something. I'd be thankfull to you guys if you can get some sense out of this.
Upvotes: 1
Views: 168
Reputation: 34518
You are using a Vec3b
iterator which is supposed to be used on 3 channel images. You are using a single channel image, to iterate such an image you have to replace Vec3b
with uchar
.
Upvotes: 3