Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

magnitude of a matrix

I have used sobel to get the gradient of an image in X and Y direction:

cv::Sobel( Min1, grad_x, Min1.depth(), 1, 0, 3);    
cv::Sobel( Min1, grad_y, Min1.depth(), 0, 1, 3);

now I have the gradient of the Min1 in X direction stored in Mat grade_x and in Y direction stored in Mat grade_y.

How do I calculate the magnitude of grad_x and grad_y? Is there any function in Opencv to get the norm of a matrix?

Thanks in advance...

click to hide/show revision 2
retagged

updated 2014-02-19 04:02:28 -0600

berak gravatar image

magnitude of a matrix

I have used sobel to get the gradient of an image in X and Y direction:

cv::Sobel( Min1, grad_x, Min1.depth(), 1, 0, 3);    
cv::Sobel( Min1, grad_y, Min1.depth(), 0, 1, 3);

now I have the gradient of the Min1 in X direction stored in Mat grade_x and in Y direction stored in Mat grade_y.

How do I calculate the magnitude of grad_x and grad_y? Is there any function in Opencv to get the norm of a matrix?

Thanks in advance...