Replace our dot product with OpenCV dot product. Some style change.
Replace our magnitude calculation with OpenCv norm()
small changes