objectImageIdentifierAI/other/cropObjects/main.py
other/cropObjects/main.pyRaw
1from os import walk
2import detectObject as do
3import matplotlib.pyplot as plt
4
5
6
7#image_data = do.imgFileToData("imgs/34.png")
8image_data = do.imgFileToData2("object/25.png")
9
10
11boundingBox = do.detectObj(image_data)
12image_data = do.prova(image_data)
13r = do.crop(image_data, boundingBox)
14
15
16import detectObjects as dos
17r_copy = r
18dos.detectObjects(r_copy)
19#do.saveDataToImageFile(image_data, "out.png")
20
21#r = do.prova(image_data)
22
23fig = plt.figure()
24ax = fig.add_subplot(121)
25ax.set_title("Original")
26ax.imshow(image_data)
27
28ax1 = fig.add_subplot(122)
29ax1.set_title("Result")
30ax1.imshow(r)
31
32plt.show()
33
34'''
35f = []
36for (dirpath, dirnames, filenames) in walk("imgs"):
37 for filename in filenames:
38 print filename
39 image_data = do.imgFileToData("imgs/" + filename)
40 boundingBox = do.detectObj(image_data)
41 print boundingBox
42'''