I’m porting some OpenCV code to Cuda. I notice that the output of this code:
auto dir = std::filesystem::current_path() / "Debug" / "";
cv::Mat image = cv::imread(dir.replace_filename("some_grayscale.png").string(), cv::IMREAD_GRAYSCALE);
cv::Mat imageFloat;
image.convertTo(imageFloat, CV_32FC1);
cv::Mat imageSobel;
cv::Sobel(imageFloat, imageSobel, CV_32FC1, 1, 1, 5);
double min = 0;
double max = 0;
cv::minMaxLoc(imageSobel, &min, &max);
for this image the min is something like -700 and max is +400…
This does not correspond to a gradient magnitude, but perhaps to a directional output? A magnitude would be using square root and be positive.
It this a directional output?
I notice examples that do x and y separately and seem to do edges but the documentation is a bit unclear. For instance, Matlab code would be:
[Gx,Gy] = imgradientxy(dI,"sobel");
[Gmag,Gdir] = imgradient(Gx,Gy);
cand would give me a magnitude and a direction separately.
Thanks
Rick