-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
95 lines (76 loc) · 2.27 KB
/
config.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# threshold_march = 10
# import matplotlib.pyplot as plt
#
# # ax = plt.gca(figsize=(9, 3), dpi=100)
# # ax.figure()
# plt.figure(figsize=(3, 8),)
# # plt.figure(figsize=(6, 4),)
# # plt.figure(figsize(8, 6))
# plt.plot([1, 2], [3, 4])
# # plt.figure(figsize=(9, 3), dpi=100)
# plt.savefig("D:\\testconfig", figsize=(3.1, 8.1), dpi=500) # 指定分辨率保存
# plt.show()
#
import numpy as np
import change
import cv2
import MyMarchingSquares
import matplotlib.pyplot as plt
import marchingsquares2
# gray = np.array([[10, 10, 10, 10], [10, 10, 11, 10], [10, 12, 5, 10], [10, 10, 10, 11],[10, 10, 10, 11]])
# print(len(gray))
# print(gray[:, -1] > 10)
# print(np.delete(gray, 2, 0))
# print(np.delete(gray, 1, 1))
# print(gray)
#
# path = "D:\\experiment\\pic\\"
# # path1 = "D:\\out\\41004__gradien.csv"
# path1 = "D:\\out\\2B9971ED33782C2C9F466FADAAB1A0C5__gradien.csv"
# # path1 = "D:\\out\\2.csv"
# src = "8068" # 天鹅
#
# re = np.loadtxt(path1, dtype=np.int, delimiter=",")
# print(re.shape[0])
# print(re.shape[1])
# x = re.shape[0]
# y = re.shape[1]
# while x > 10 or y > 10:
# x /= 10
# y /= 10
# print(x)
# print(y)
#
# path = "D:\\experiment\\pic\\"
# path1 = "D:\\out\\acs.csv"
# # path1 = "D:\\out\\2B9971ED33782C2C9F466FADAAB1A0C5__gradien.csv"
# # path1 = "D:\\out\\2.csv"
# src = "acs"
#
# re = np.loadtxt(path1, delimiter=",")
# # re = np.loadtxt(path1, delimiter=',', usecols=range(48))
# # re = np.genfromtxt(path1, delimiter=',')[:, :-1]
#
# x, y = MyMarchingSquares.traverse(MyMarchingSquares.labels_matrix(re, 20))
#
# length = re.shape[0]
# width = re.shape[1]
# while length > 10 or width > 10:
# length /= 10
# width /= 10
#
# # plt.xticks([])
# # plt.yticks([])
# plt.figure(figsize=(width, length), dpi=500)
# plt.gca().invert_yaxis() # y轴反向
# # plt.axis('off')
#
# for i in range(0, len(x), 2):
# # plt.plot([y[i], y[i + 1]], [x[i], x[i + 1]], color='white', lw=0.5)
# plt.plot([y[i], y[i + 1]], [x[i], x[i + 1]], color='black', lw=0.5)
#
# # plt.savefig("D:\\fix_noise__" + src + "___noise_num:"+str(noise_num), figsize=(width, length), facecolor='black',
# # dpi=500) # 指定分辨率保存
# plt.savefig("D:\\cs____" + src, figsize=(width, length), facecolor='black',
# dpi=500) # 指定分辨率保存
# plt.show()