Update steganalysis functions.

This commit is contained in:
Cédric Bonhomme 2016-08-04 21:30:51 +02:00
parent d3d03c2f74
commit 0d1c5cc4c1
No known key found for this signature in database
GPG key ID: A1CB94DE57B7A70D
4 changed files with 18 additions and 38 deletions

View file

@ -50,19 +50,3 @@ def steganalyse(img):
b = 255
encoded.putpixel((col, row), (r, g , b))
return encoded
if __name__ == '__main__':
# Point of entry in execution mode.
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-i", "--input", dest="input_image_file",
help="Image file")
parser.add_option("-o", "--output", dest="output_image_file",
help="Image file")
parser.set_defaults(input_image_file = './pictures/Lenna.png',
output_image_file = './pictures/Lenna_steganalysed.png')
(options, args) = parser.parse_args()
input_image_file = Image.open(options.input_image_file)
output_image = steganalyse(input_image_file)
output_image.save(options.output_image_file)

View file

@ -55,16 +55,14 @@ def steganalyse(img):
if __name__ == '__main__':
# Point of entry in execution mode.
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-i", "--input", dest="input_image_file",
import argparse
parser = argparse.ArgumentParser(prog='steganalysis-statistics')
parser.add_argument("-i", "--input", dest="input_image_file",
help="Image file.")
parser.add_option("-o", "--output", dest="output_image_file",
parser.add_argument("-o", "--output", dest="output_image_file",
help="Image file.")
parser.set_defaults(input_image_file = './pictures/Lenna.png',
output_image_file = './pictures/Lenna_steganalysed.png')
(options, args) = parser.parse_args()
arguments = parser.parse_args()
input_image_file = Image.open(options.input_image_file)
input_image_file = Image.open(arguments.input_image_file)
output_image = steganalyse(input_image_file)
soutput_image.save(options.output_image_file)
soutput_image.save(arguments.output_image_file)