First time here? Check out the FAQ!
answered 2018-06-04 21:48:04 -0600
You did
Mat x = mplane[0];
This is a shallow copy, so a few lines down when you do
magnitude(mplane[0], mplane[1], mplane[0]);
you overwrite the values in x.
Use the .clone() method to get a deep copy.