OpenCV's Sobel filter - why does it look so bad, especially compared to Gimp?
<p>I'm trying to rebuild some preprocessing I have done before in Gimp, using OpenCV. The first stage is a Sobel filter for edge detection. It works very well in Gimp:</p>

<p><a href="https://i.stack.imgur.com/v9QPm.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/v9QPm.jpg" alt="enter image description here"></a></p>

<p>Now here is my attempt with OpenCV:</p>

<pre class="lang-scala prettyprint-override"><code>opencv_imgproc.Sobel(/* src = */ scaled, /* dst = */ sobel,
  /* ddepth = */ opencv_core.CV_32F,
  /* dx = */ 1, /* dy = */ 1, /* ksize = */ 5, /* scale = */ 0.25,
  /* delta = */ 0.0, /* borderType = */ opencv_core.BORDER_REPLICATE)
</code></pre>

<p>It looks very bad, basically highlighting points instead of contours:</p>

<p><a href="https://i.stack.imgur.com/MODWT.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/MODWT.jpg" alt="enter image description here"></a></p>

<p>So what am I doing wrong, or how does Gimp achieve such a good result and how can I replicate it in OpenCV?</p>