Sobel (Edge) function in Matlab and OpenCV sobel operation have different implementations. Can you please provide explanation and reference

조회 수: 3 (최근 30일)
I want to perform a sobel operation on an image using the "edge" function and compare this against the OpenCV Sobel operation.
A closer look into the edge function reveals that it uses a threshold in the final outcome. Why is this done?
Also, a parameter called cutoff is created as follows (edge.m line number - 412) cutoff = scale*mean2(b); Why is the mean calculated and cutoff estimated from it?
The comments above it (edge.m line 407) says % determine the threshold; see page 514 of "Digital Imaging Processing" by William K. Pratt". I looked up in the third edition of the book but didnt find anything relevant there. Can you please provide some reference on the Sobel operation in this regard.
Also the function goes on to use computeedge function (edge.m line number - 419). Typing "help computeedge" does not provide any documentation as to what is happening in this function.
Request you to kindly provide more information.
Thanks & Regards,
Mazhar

답변 (1개)

Image Analyst
Image Analyst 2015년 10월 20일
imgradient will give you the unthresholded image:
grayImage = imread('coins.png');
% Calculate gradients and display.
[Gmag, Gdir] = imgradient(grayImage,'sobel');
imshowpair(Gmag, Gdir, 'montage');
title('Gradient Magnitude, Gmag (left), and Gradient Direction, Gdir (right), using Prewitt method')
axis on;

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by