Skip to content

Commit e3155c7

Browse files
committed
[change] add output feature & change content of gitignore
1. Add output feature of superpixel code (current output .png image). 2. Change content of gitignore to exclude the output .png image.
1 parent 0677b2a commit e3155c7

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ result_image/
111111

112112
# just track certain images
113113
*.jpg
114+
*.png
114115
!coins.jpg
115116
!四破魚(藍圓鰺)2.jpg
116117
!8ubS9.jpg

superpixel.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@
66
from skimage.util import img_as_float
77
from skimage import io
88

9-
image = img_as_float(io.imread('coins.jpg'))
9+
import os
10+
11+
inputfile = 'coins.jpg'
12+
output_slic = os.path.splitext(inputfile)[0] + '_slic' + '.png'
13+
output_quickshift = os.path.splitext(inputfile)[0] + '_quickshift' + '.png'
14+
15+
image = img_as_float(io.imread(inputfile))
1016

1117
segments_slic = slic(image, n_segments = 100, sigma = 5)
1218
segments_quickshift = quickshift(image, kernel_size = 5, max_dist = 6, ratio = 0.5)
@@ -26,3 +32,6 @@
2632

2733
plt.tight_layout()
2834
plt.show()
35+
36+
plt.imsave(output_slic, slic_result)
37+
plt.imsave(output_quickshift, quickshift_result)

0 commit comments

Comments
 (0)