Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7501eea

Browse files
syurkevi9prady9
authored andcommitted
image range updates fixing matching
1 parent 0570570 commit 7501eea

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

‎examples/computer_vision/fast.py‎

Lines changed: 5 additions & 5 deletions
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‎

Lines changed: 3 additions & 3 deletions
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‎

Lines changed: 3 additions & 3 deletions
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)

AltStyle によって変換されたページ (->オリジナル) /