You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Task: Calculate the vector of Minkowski dimensions for the selected image when resizing the split cell.
3
+
4
+
How to run:
5
+
* Go to the folder containing the program code and image
6
+
7
+
* Type in the console "python count_vector.py" or "python3 count_vector.py"
8
+
9
+
* You will be prompted to enter the name of the image file located in the same folder as the program code. If you don't enter any name, the default program will try to find a file named "image.jpg"
10
+
11
+
* To plot multiple files, enter multiple image names separated by spaces: "image1.jpg image2.jpg image3.jpg"
12
+
13
+
* The image you submit for entry may be in color. The program itself will invert it into a black and white image, saving it with the name "inverted_" + the name of the original image
14
+
15
+
* Next, the file "result_graph.png" will be created
print("Please, type the name of the file. Or press enter to skip. Default name is image.jpg\n You can type multiple file names, separated by space\n Example: 'image1.jpg image2.jpg image3.jpg'")
76
+
names=input()
77
+
ifnotnames:
78
+
names= ['image.jpg']
79
+
else:
80
+
names=names.split(' ')
81
+
try:
82
+
plt.cla()
83
+
fig, ax=plt.subplots()
84
+
fornameinnames:
85
+
im=Image.open(name)
86
+
im=convert_image(im, 'inverted_'+name)
87
+
file_data=get_graph_data(im)
88
+
ax.plot(CELL_SIZES, file_data, label=name)
89
+
90
+
ax.set_xlabel('cell size')
91
+
ax.set_ylabel('Dimension')
92
+
ax.legend()
93
+
fig.savefig("result_graph.png")
94
+
finished=True
95
+
exceptExceptionase:
96
+
print(e)
97
+
print("Could not find the file. Please try again.")
0 commit comments