Skip to content

Commit f1e396a

Browse files
committed
image range updates fixing matching
1 parent ee3deff commit f1e396a

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

examples/computer_vision/fast.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ def draw_corners(img, x, y, draw_len):
2525

2626
# Draw vertical line of (draw_len * 2 + 1) pixels centered on the corner
2727
# Set only the first channel to 1 (green lines)
28-
ymin = max(0, y - draw_len)
29-
ymax = min(img.dims()[0], y + draw_len)
28+
ymin = int(max(0, y - draw_len))
29+
ymax = int(min(img.dims()[0], y + draw_len))
3030

3131
img[ymin : ymax, x, 0] = 0.0
3232
img[ymin : ymax, x, 1] = 1.0
@@ -40,13 +40,13 @@ def fast_demo(console):
4040
else:
4141
img_color = af.load_image("../../assets/examples/images/man.jpg", True);
4242

43-
img_color /= 255.0
4443
img = af.color_space(img_color, af.CSPACE.GRAY, af.CSPACE.RGB)
44+
img_color /= 255.0
4545

4646
features = af.fast(img)
4747

48-
xs = features.get_xpos()
49-
ys = features.get_ypos()
48+
xs = features.get_xpos().to_list()
49+
ys = features.get_ypos().to_list()
5050

5151
draw_len = 3;
5252
num_features = features.num_features().value

examples/computer_vision/harris.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ def harris_demo(console):
4040
else:
4141
img_color = af.load_image("../../assets/examples/images/man.jpg", True);
4242

43-
img_color /= 255.0
4443
img = af.color_space(img_color, af.CSPACE.GRAY, af.CSPACE.RGB)
44+
img_color /= 255.0
4545

4646
ix, iy = af.gradient(img)
4747
ixx = ix * ix
@@ -100,8 +100,8 @@ def harris_demo(console):
100100
else:
101101
idx = af.where(corners)
102102

103-
corners_x = idx / corners.dims()[0]
104-
corners_y = idx % corners.dims()[0]
103+
corners_x = idx / float(corners.dims()[0])
104+
corners_y = idx % float(corners.dims()[0])
105105

106106
print(corners_x)
107107
print(corners_y)

examples/computer_vision/susan.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ def susan_demo(console):
4040
else:
4141
img_color = af.load_image("../../assets/examples/images/man.jpg", True);
4242

43-
img_color /= 255.0
4443
img = af.color_space(img_color, af.CSPACE.GRAY, af.CSPACE.RGB)
44+
img_color /= 255.0
4545

4646
features = af.susan(img)
4747

48-
xs = features.get_xpos()
49-
ys = features.get_ypos()
48+
xs = features.get_xpos().to_list()
49+
ys = features.get_ypos().to_list()
5050

5151
draw_len = 3;
5252
num_features = features.num_features().value

0 commit comments

Comments
 (0)