Sobel automatically default to Scharr when kernel size == 3? [closed]

asked 2018-09-09 04:21:45 -0500

Martian gravatar image

updated 2018-09-11 23:07:05 -0500

From the OpenCV docs:

Sobel is only an approximation of the derivative). OpenCV addresses this inaccuracy for kernels of size 3 by using the Scharr() function.

Does this mean that calling "Sobel()" with a kernel size of 3 will actually call the Scharr() function internally?

NOTE: One of the reasons this question was posed is that there are comments that indicate that Sobel does indeed roll over to Scharr in this case. I did not find the docs (quoted above)to be clear on the subject, which may be the reason for the contradictory info. The followup reply by Berak (now deleted for some reason?) does cite Scharr options within Sobel functions, but I did not see any specifics regarding 'rollover' to Scharr, as implied by the quoted docs above.

So I'm not sure why this query shows as 'deleted' at the moment.

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by berak
close date 2018-09-11 23:42:07.726340


lol, i don't remember anything.

look at the src

berak gravatar imageberak ( 2018-09-11 23:11:56 -0500 )edit

and no, there is no "automatic rollover" (whatever you meant by that)

you have to explicitly specify CV_SCHARR for ksize, to use a Scharr kernel (of size 3).

berak gravatar imageberak ( 2018-09-11 23:35:40 -0500 )edit

also: please do not post duplicate questions here

berak gravatar imageberak ( 2018-09-11 23:42:00 -0500 )edit

Hi Berak, Oh yeah, you had replied. I stopped in to comment and thank you for the link, but your reply was gone, and the original was marked 'deleted.' (???) I thought I was on StackOverflow there for a second. :-) Seriously, the reply was helpful, especially in that there is contradictory information out there about this. Understandable, given that the line that I quoted above could easily be misinterpreted.

In my app, I'm computing phase angles via vertical and horizontal Sobel, and thought that perhaps Scharr would be worth checking. Tough to gauge the overall effect on final output, so I didn't want to go through the changes and tedious rounds of testing if it was effectively in place already.

Martian gravatar imageMartian ( 2018-09-11 23:57:50 -0500 )edit

Duplicate questions?

Martian gravatar imageMartian ( 2018-09-11 23:58:59 -0500 )edit

PS, now that I think about it, perhaps it was Sturkman that posted the original reply? No evidence of the post now, so it's difficult to tell. Unfortunate, as there was a link to example code that I wanted to follow.

In regard to 'rollover': I was referring to automatic referral from Sobel to Scharr. Yes, I get from the replies that it is not the case, so no further need to clarify.

Martian gravatar imageMartian ( 2018-09-12 00:09:13 -0500 )edit

yea i think so, too.

berak gravatar imageberak ( 2018-09-12 00:13:28 -0500 )edit

Berak, I did not see any duplicate questions. I always check. Perhaps you can clarify why this thread now says 'closed as duplicate'? I understand the answer, so It's OK with me if someone wants to delete the thread for some reason, but it would be good to understand why it's a duplicate.

Martian gravatar imageMartian ( 2018-09-12 00:22:43 -0500 )edit

but you do see it now, don't you ?

let's just settle it.

berak gravatar imageberak ( 2018-09-12 00:27:58 -0500 )edit

Berak, If you're implying that I reposted the question, be assured that I did not.

I can see what you're referring to now though. I just clicked on my icon to see what you were talking about, and it shows -TWO- duplicates, not just one (total of three posts!?). The other two are listed out of order on a different page. That was not my doing. Something in your software must be splitting the thread into separate copies.

Martian gravatar imageMartian ( 2018-09-12 03:47:41 -0500 )edit