-
Notifications
You must be signed in to change notification settings - Fork 0
/
contour_test.py
40 lines (31 loc) · 852 Bytes
/
contour_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from skimage import data
from skimage import measure
from scipy import ndimage
import numpy as np
#import matplotlib.pyplot as plt
import pylab
import time
name = raw_input("Name of Picture: ")
im = ndimage.imread(name, True)
height = len(im)
num = 9
multiple = 25
all_cont = []
for i in range(0, num, 1):
contours = measure.find_contours(im, i * multiple)
all_cont.append(contours)
num_cont = 0
pylab.subplot(300 + 10 * num / 3 + i + 1)
for n, contour in enumerate(contours):
pylab.plot(contour[:, 1], height - contour[:, 0], linewidth=2)
pylab.title("Value of sigma: " + str(i * multiple))
pylab.draw()
start = time.time()
counter = 0
pylab.draw()
print(i)
pylab.figure(2)
for i in range(1, len(all_cont)):
for n, contour in enumerate(all_cont[i]):
pylab.plot(contour[:, 1], height - contour[:, 0], linewidth=2)
pylab.show()