From 20e0ccdea85a7aea1b03df39a827d4bd3ca372d8 Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Mon, 14 Dec 2015 00:39:11 -0800 Subject: [PATCH] Draw daisy features using anti-aliasing (closes #1665) --- skimage/feature/_daisy.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/skimage/feature/_daisy.py b/skimage/feature/_daisy.py index 6dca0c59470..df5cf4f4c45 100644 --- a/skimage/feature/_daisy.py +++ b/skimage/feature/_daisy.py @@ -181,20 +181,20 @@ def daisy(img, step=4, radius=15, rings=3, histograms=8, orientations=8, for i in range(descs.shape[0]): for j in range(descs.shape[1]): # Draw center histogram sigma - color = (1, 0, 0) + color = [1, 0, 0] desc_y = i * step + radius desc_x = j * step + radius - coords = draw.circle_perimeter(desc_y, desc_x, int(sigmas[0])) - draw.set_color(descs_img, coords, color) + rows, cols, val = draw.circle_perimeter_aa(desc_y, desc_x, int(sigmas[0])) + draw.set_color(descs_img, (rows, cols), color, alpha=val) max_bin = np.max(descs[i, j, :]) for o_num, o in enumerate(orientation_angles): # Draw center histogram bins bin_size = descs[i, j, o_num] / max_bin dy = sigmas[0] * bin_size * sin(o) dx = sigmas[0] * bin_size * cos(o) - coords = draw.line(desc_y, desc_x, int(desc_y + dy), - int(desc_x + dx)) - draw.set_color(descs_img, coords, color) + rows, cols, val = draw.line_aa(desc_y, desc_x, int(desc_y + dy), + int(desc_x + dx)) + draw.set_color(descs_img, (rows, cols), color, alpha=val) for r_num, r in enumerate(ring_radii): color_offset = float(1 + r_num) / rings color = (1 - color_offset, 1, color_offset) @@ -202,9 +202,9 @@ def daisy(img, step=4, radius=15, rings=3, histograms=8, orientations=8, # Draw ring histogram sigmas hist_y = desc_y + int(round(r * sin(t))) hist_x = desc_x + int(round(r * cos(t))) - coords = draw.circle_perimeter(hist_y, hist_x, - int(sigmas[r_num + 1])) - draw.set_color(descs_img, coords, color) + rows, cols, val = draw.circle_perimeter_aa(hist_y, hist_x, + int(sigmas[r_num + 1])) + draw.set_color(descs_img, (rows, cols), color, alpha=val) for o_num, o in enumerate(orientation_angles): # Draw histogram bins bin_size = descs[i, j, orientations + r_num * @@ -213,10 +213,10 @@ def daisy(img, step=4, radius=15, rings=3, histograms=8, orientations=8, bin_size /= max_bin dy = sigmas[r_num + 1] * bin_size * sin(o) dx = sigmas[r_num + 1] * bin_size * cos(o) - coords = draw.line(hist_y, hist_x, - int(hist_y + dy), - int(hist_x + dx)) - draw.set_color(descs_img, coords, color) + rows, cols, val = draw.line_aa(hist_y, hist_x, + int(hist_y + dy), + int(hist_x + dx)) + draw.set_color(descs_img, (rows, cols), color, alpha=val) return descs, descs_img else: return descs