Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

vector out of range

Hi there, working on a robotics application.

My program is crashing at this exact point ( i'm proceeding the edges and findcontours operations) it used to work but it seems it doesn't anymore since i moved the Mat and all the declarations out of the function to put it in the whole file, so i can access it in other functions.

void Edges(){

imread then cvtcolor .. blur .. canny.. findcontours.. etc.. it all works.

now i'm proceeding: for (unsigned int i = 0; i<contours.size(); i++){="" drawcontours(drawing,contours,i,(255,255,255),1,8,hierarchy,0,point()="" );="" this="" works="" again<="" p="">

and now: for (unsigned int i =0; i<contourssize(); i++){="" mucircle[i]="moments" (contours[i],false);<="" p="">

once this is reached it crashes and i get:

Debug assertion failed vector subscript out of range. on msdn i can read that this kind of error is due to accessing a vector value which doesn't exist. But thanks to the debug flag, i can see that the program does crash at this very exact point. and until then i never use vector.

any ideas??

vector out of range

Hi there, working on a robotics application.

My program is crashing at this exact point ( i'm proceeding the edges and findcontours operations) it used to work but it seems it doesn't anymore since i moved the Mat and all the declarations out of the function to put it in the whole file, so i can access it in other functions.

void Edges(){

imread then cvtcolor .. blur .. canny.. findcontours.. etc.. it all works.

now i'm proceeding: for (unsigned int i = 0; i<contours.size(); i++){="" drawcontours(drawing,contours,i,(255,255,255),1,8,hierarchy,0,point()="" );="" this="" works="" again<="" );<="" p="">

and now: this works again and now:

for (unsigned int i =0; i<contourssize(); i++){="" mucircle[i]="moments" (contours[i],false);<="" p="">

once this is reached it crashes and i get:

Debug assertion failed vector subscript out of range. on msdn i can read that this kind of error is due to accessing a vector value which doesn't exist. But thanks to the debug flag, i can see that the program does crash at this very exact point. and until then i never use vector.

any ideas??

click to hide/show revision 3
No.3 Revision

vector out of range

Hi there, working on a robotics application.

My program is crashing at this exact point ( i'm proceeding the edges and findcontours operations) it used to work but it seems it doesn't anymore since i moved the Mat and all the declarations out of the function to put it in the whole file, so i can access it in other functions.

void Edges(){

Edges() { imread then cvtcolor .. blur .. canny.. findcontours.. etc.. it all works.

works.

now i'm proceeding: proceeding:

for (unsigned int i = 0; i<contours.size(); i++){="" drawcontours(drawing,contours,i,(255,255,255),1,8,hierarchy,0,point()="" );<="" p="">

i++){ drawContours(drawing,contours,i,(255,255,255),1,8,hierarchy,0,point() );

this works again again and now:

for (unsigned int i =0; i<contourssize(); i++){="" mucircle[i]="moments" (contours[i],false);<="" p="">

i<contours.size(); i++){ muCircle[i] = moments (contours[i],false);

once this is reached it crashes and i get:

Debug assertion failed
vector subscript out of range.

on msdn i can read that this kind of error is due to accessing a vector value which doesn't exist. But thanks to the debug flag, i can see that the program does crash at this very exact point. and until then i never use vector.

any ideas??