-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
24 lines (19 loc) · 731 Bytes
/
main.py
File metadata and controls
24 lines (19 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import argparse
from Graph import Graph
from ImageProcessing import IP
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description=
'Image Coloring with Connected-component Labeling, Neighborhood Component and Graph Coloring Algorithms.'
)
parser.add_argument('--input', help='Path to input image.', default='teh.png')
args = parser.parse_args()
print("Processing Input Image ...", end=" ")
ip = IP(args.input)
print("Calculating Adjacency Matrix ...", end=" ")
matrix = ip.adjacency_matrix()
print("Graph Coloring ...", end=" ")
g = Graph(matrix[0].__len__(), matrix)
colors = g.coloring()
print("Press a Key To Continue.")
ip.show(colors)