Aren't you using Vec3b instead of Vec3i ?
CV_8UC3 means your image has 8 bits, 3 channels, unsigned char. So far, Vec3i for the whole 3 channels, and Vec3b is for the 3 channels without the char sign.
So, I think you should use Vec3b
Sunny
source share