Movatterモバイル変換


[0]ホーム

URL:


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

Commit5416519

Browse files
committed
Use os path util to fetch example path to determine assets location
1 parent7501eea commit5416519

File tree

4 files changed

+24
-8
lines changed

4 files changed

+24
-8
lines changed

‎examples/computer_vision/fast.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
fromtimeimporttime
1313
importarrayfireasaf
14+
importos
1415
importsys
1516

1617
defdraw_corners(img,x,y,draw_len):
@@ -35,10 +36,13 @@ def draw_corners(img, x, y, draw_len):
3536

3637
deffast_demo(console):
3738

39+
root_path=os.path.dirname(os.path.abspath(__file__))
40+
file_path=root_path
3841
ifconsole:
39-
img_color=af.load_image("../../assets/examples/images/square.png",True);
42+
file_path+="/../../assets/examples/images/square.png"
4043
else:
41-
img_color=af.load_image("../../assets/examples/images/man.jpg",True);
44+
file_path+="/../../assets/examples/images/man.jpg"
45+
img_color=af.load_image(file_path,True);
4246

4347
img=af.color_space(img_color,af.CSPACE.GRAY,af.CSPACE.RGB)
4448
img_color/=255.0

‎examples/computer_vision/harris.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
fromtimeimporttime
1313
importarrayfireasaf
14+
importos
1415
importsys
1516

1617
defdraw_corners(img,x,y,draw_len):
@@ -35,10 +36,13 @@ def draw_corners(img, x, y, draw_len):
3536

3637
defharris_demo(console):
3738

39+
root_path=os.path.dirname(os.path.abspath(__file__))
40+
file_path=root_path
3841
ifconsole:
39-
img_color=af.load_image("../../assets/examples/images/square.png",True);
42+
file_path+="/../../assets/examples/images/square.png"
4043
else:
41-
img_color=af.load_image("../../assets/examples/images/man.jpg",True);
44+
file_path+="/../../assets/examples/images/man.jpg"
45+
img_color=af.load_image(file_path,True);
4246

4347
img=af.color_space(img_color,af.CSPACE.GRAY,af.CSPACE.RGB)
4448
img_color/=255.0

‎examples/computer_vision/matching.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
fromtimeimporttime
1313
importarrayfireasaf
14+
importos
1415
importsys
1516

1617
defnormalize(a):
@@ -45,10 +46,13 @@ def draw_rectangle(img, x, y, wx, wy):
4546

4647
deftemplateMatchingDemo(console):
4748

49+
root_path=os.path.dirname(os.path.abspath(__file__))
50+
file_path=root_path
4851
ifconsole:
49-
img_color=af.load_image("../../assets/examples/images/square.png",True);
52+
file_path+="/../../assets/examples/images/square.png"
5053
else:
51-
img_color=af.load_image("../../assets/examples/images/man.jpg",True);
54+
file_path+="/../../assets/examples/images/man.jpg"
55+
img_color=af.load_image(file_path,True);
5256

5357
# Convert the image from RGB to gray-scale
5458
img=af.color_space(img_color,af.CSPACE.GRAY,af.CSPACE.RGB)

‎examples/computer_vision/susan.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
fromtimeimporttime
1313
importarrayfireasaf
14+
importos
1415
importsys
1516

1617
defdraw_corners(img,x,y,draw_len):
@@ -35,10 +36,13 @@ def draw_corners(img, x, y, draw_len):
3536

3637
defsusan_demo(console):
3738

39+
root_path=os.path.dirname(os.path.abspath(__file__))
40+
file_path=root_path
3841
ifconsole:
39-
img_color=af.load_image("../../assets/examples/images/square.png",True);
42+
file_path+="/../../assets/examples/images/square.png"
4043
else:
41-
img_color=af.load_image("../../assets/examples/images/man.jpg",True);
44+
file_path+="/../../assets/examples/images/man.jpg"
45+
img_color=af.load_image(file_path,True);
4246

4347
img=af.color_space(img_color,af.CSPACE.GRAY,af.CSPACE.RGB)
4448
img_color/=255.0

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp