how to calculate gradient in c++ using Opencv?
Dear guys
I'm new in opencv, I'm looking for a simple method to find out how to calculate gradient of an image for sobel filter.
Dear guys
I'm new in opencv, I'm looking for a simple method to find out how to calculate gradient of an image for sobel filter.
the question might be a bit unclear, but i guess, you wanted the gradient, as in : "angles" and "magnitude", which might be achieved using 2 Sobel calls and cartToPolar
Mat img = ...
cvtColor(img, img, COLOR_BGR2GRAY);
Mat dx, dy; // 1st derivative in x,y
Sobel(img, dx, CV_32F, 1,0);
Sobel(img, dx, CV_32F, 0,1);
Mat angle, mag;
cartToPolar(dx, dy, mag, angle);
Asked: 2017-03-29 03:37:22 -0600
Seen: 3,637 times
Last updated: Mar 30 '17
OpenCV DescriptorMatcher matches
Conversion between IplImage and MxArray
Video On Label OpenCV Qt :: hide cvNamedWindows
Problems using the math.h class with OpenCV (c++, VS2012)
How to reduce false positives for face detection
Area of a single pixel object in OpenCV
build problems for android_binary_package - Eclipse Indigo, Ubuntu 12.04
Can't compile .cu file when including opencv.hpp
Using OpenCV's stitching module, strange error when compositing images