@@ -0,0 +1,1065 @@
+#!/usr/bin/env python2%0A# -*- coding: utf-8 -*-%0A# Author: Francois Boulogne%0A# License: GPL%0A%0A%22%22%22%0A========================%0ACircular Hough Transform%0A========================%0A%0A%0A%0A%22%22%22%0A%0A%0Aimport numpy as np%0Aimport matplotlib.pyplot as plt%0Aimport matplotlib.patches as mpatches%0A%0Afrom skimage import data, filter%0Afrom skimage.transform import hough_circle%0Afrom skimage.feature import peak_local_max%0A%0A# Load picture and detect edges%0Aimage = data.coins()%5B0:95, 70:370%5D%0Aedges = filter.canny(filter.sobel(image), sigma=2.8)%0A%0A%0Afig, ax = plt.subplots(ncols=1, nrows=1, figsize=(6, 6))%0Aax.imshow(image, cmap=plt.cm.gray)%0A%0A# Detect two radii%0Aradii = np.array(%5B21, 25%5D)%0Ahough_res = hough_circle(edges, radii)%0A%0Afor radius, h in zip(radii, hough_res):%0A    # For each radius, keep two circles%0A    maxima = peak_local_max(h, num_peaks=2)%0A    for maximum in maxima:%0A        center_x, center_y = maximum - radii.max()%0A        circ = mpatches.Circle((center_y, center_x), radius,%0A                               fill=False, edgecolor='red', linewidth=2)%0A        ax.add_patch(circ)%0A%0Aplt.show()%0A

add example for cicular hough transform