First time here? Check out the FAQ!
The way you created your ranges is incorrect, and initializing a Mat from a 3 column array instead of a 4 column array g