I have faced the similar problems with jni. I don't know why this happens but this seems to work.
DMatch match;
match = matches[i];
if( match.distance < 3*min_dist )
{ good_matches.push_back( match); }
This would work. I have been getting similar vector indexing errors.