-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.py
74 lines (54 loc) · 2.38 KB
/
init.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
from Image.Image import Img
from wavelets.wavelets import imageDWT
from methods import Steganography
from analysis import Analysis
from tqdm import tqdm
from plots import barCharts, clasterisationPlots
from appData import get100BytesMessage, getDiploma, testImages, elmData, lsbData, kohonenData
def testImagesDWT():
print('Images DWT calculation')
for image in tqdm(testImages):
i = Img(image)
i.toArray()
imageDWT(i, 'imageDWT/' + testImages.get(image) + '.tiff')
def testImagesAnalyze():
print('Analysis started')
for image in tqdm(testImages):
a = Analysis(image, 'encryptedLSB/' + testImages.get(image) + '.tiff')
lsbData[testImages.get(image)] = [a.mse * 10, a.correlation, a.ssim, a.fusion / 10]
a = Analysis(image, 'KOHONENencrypted/' + testImages.get(image) + '.tiff')
kohonenData[testImages.get(image)] = [a.mse , a.correlation, a.ssim, a.fusion]
kohonenAnalysisData = a.normalize(kohonenData)
print(lsbData)
print(kohonenAnalysisData)
barCharts(['baboon', 'airplane', 'peppers', 'earth'])
def allMethodsRun(message):
for image in testImages:
# --------------------------- LSB ---------------------------------------
s = Steganography(image, message, 'lsb', 'encryptedLSB/' + testImages.get(image) + '.tiff')
s.encrypt()
m = s.decrypt()
f = open('decryptedMessages/' + testImages.get(image) + '_LSB.txt', 'w')
f.write(m)
f.close()
print('decrypted message', m)
# --------------------------- /LSB ---------------------------------------
# --------------------------- KOHONEN ---------------------------------------
s = Steganography(image, message, 'kohonen', 'KOHONENencrypted/' + testImages.get(image) + '.tiff')
s.encrypt()
m = s.decrypt()
f = open('decryptedMessages/' + testImages.get(image) + '_kohonen.txt', 'w')
f.write(m)
f.close()
print('decrypted message', m)
# --------------------------- /KOHONEN ---------------------------------------
def main():
# message100Bytes = get100BytesMessage()
# allMethodsRun(message100Bytes)
# diploma = getDiploma()
# allMethodsRun(diploma)
# testImagesDWT()
# clasterisationPlots()
testImagesAnalyze()
if __name__ == '__main__':
main()