493c862567da8e61ba3f21883e680de00dd0531e,doc/examples/edges/plot_edge_filter.py,,,#,18

Before Change



ax0.imshow(edge_roberts, cmap=plt.cm.gray)
ax0.set_title("Roberts Edge Detection")
ax0.axis("off")

ax1.imshow(edge_sobel, cmap=plt.cm.gray)
ax1.set_title("Sobel Edge Detection")
ax1.axis("off")

plt.tight_layout()

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Different operators compute different finite-difference approximations of
// the gradient. For example, the Scharr filter results in a less rotational
// variance than the Sobel filter that is in turn better than the Prewitt
// filter [1]_ [2]_ [3]_. The difference between the Prewitt and Sobel filters
// and the Scharr filter is illustrated below with an image that is the
// discretization of a rotation- invariant continuous function. The
// discrepancy between the Prewitt and Sobel filters, and the Scharr filter is
// stronger for regions of the image where the direction of the gradient is
// close to diagonal, and for regions with high spatial frequencies. For the
// example image the differences between the filter results are very small and
// the filter results are visually almost indistinguishable.
//
// .. [1] https://en.wikipedia.org/wiki/Sobel_operator//Alternative_operators
//
// .. [2] B. Jaehne, H. Scharr, and S. Koerkel. Principles of filter design.
//        In Handbook of Computer Vision and Applications. Academic Press,
//        1999.
//
// .. [3] https://en.wikipedia.org/wiki/Prewitt_operator

x, y = np.ogrid[:100, :100]
// Rotation-invariant image with different spatial frequencies
img = np.exp(1j * np.hypot(x, y)**1.3 / 20.).real

edge_sobel = sobel(img)
edge_scharr = scharr(img)
edge_prewitt = prewitt(img)

diff_scharr_prewitt = edge_scharr - edge_prewitt
diff_scharr_sobel = edge_scharr - edge_sobel
max_diff = np.max(np.maximum(diff_scharr_prewitt, diff_scharr_sobel))

fig, ((ax0, ax1), (ax2, ax3)) = plt.subplots(nrows=2, ncols=2, sharex=True, sharey=True, subplot_kw={"adjustable":"box-forced"})

ax0.imshow(img, cmap=plt.cm.gray)
ax0.set_title("Original image")
ax0.axis("off")

ax1.imshow(edge_scharr, cmap=plt.cm.gray)
ax1.set_title("Scharr Edge Detection")
ax1.axis("off")

ax2.imshow(diff_scharr_prewitt, cmap=plt.cm.gray, vmax=max_diff)
ax2.set_title("Scharr - Prewitt")
ax2.axis("off")

ax3.imshow(diff_scharr_sobel, cmap=plt.cm.gray, vmax=max_diff)
ax3.set_title("Scharr - Sobel")
ax3.axis("off")

After Change



fig, axes = plt.subplots(nrows=2, ncols=2, sharex=True, sharey=True,
                         figsize=(12, 12))
ax = axes.ravel()

ax[0].imshow(img, cmap=plt.cm.gray)
ax[0].set_title("Original image")

ax[1].imshow(edge_scharr, cmap=plt.cm.gray)
ax[1].set_title("Scharr Edge Detection")

ax[2].imshow(diff_scharr_prewitt, cmap=plt.cm.gray, vmax=max_diff)
ax[2].set_title("Scharr - Prewitt")

ax[3].imshow(diff_scharr_sobel, cmap=plt.cm.gray, vmax=max_diff)
ax[3].set_title("Scharr - Sobel")

for a in ax:
    a.axis("off")

plt.tight_layout()
plt.show()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: scikit-image/scikit-image
Commit Name: 493c862567da8e61ba3f21883e680de00dd0531e
Time: 2016-09-04
Author: multicolor.mood@gmail.com
File Name: doc/examples/edges/plot_edge_filter.py
Class Name:
Method Name:


Project Name: scikit-image/scikit-image
Commit Name: 493c862567da8e61ba3f21883e680de00dd0531e
Time: 2016-09-04
Author: multicolor.mood@gmail.com
File Name: doc/examples/edges/plot_edge_filter.py
Class Name:
Method Name:


Project Name: scikit-image/scikit-image
Commit Name: f877491f58df5667e65aff742f872625cb48df56
Time: 2016-06-07
Author: devel@sciunto.org
File Name: doc/examples/filters/plot_inpaint.py
Class Name:
Method Name:


Project Name: scikit-image/scikit-image
Commit Name: fa36bea1c3fc38cdbc8c35c6b12d07b5c3f07b25
Time: 2021-03-24
Author: devel@sciunto.org
File Name: doc/examples/edges/plot_canny.py
Class Name:
Method Name: