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

@ -20,9 +20,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>
__author__ = "Cedric Bonhomme"
__version__ = "$Revision: 0.5.1 $"
__version__ = "$Revision: 0.6 $"
__date__ = "$Date: 2016/03/18 $"
__revision__ = "$Date: 2016/05/22 $"
__revision__ = "$Date: 2016/08/04 $"
__license__ = "GPLv3"
try:

View file

@ -20,8 +20,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>
__author__ = "Cedric Bonhomme"
__version__ = "$Revision: 0.5 $"
__date__ = "$Date: 2016/03/18 $"
__version__ = "$Revision: 0.6 $"
__date__ = "$Date: 2016/08/04 $"
__license__ = "GPLv3"
try:
@ -31,16 +31,14 @@ except:
from PIL import Image
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-i", "--input", dest="input_image_file",
import argparse
parser = argparse.ArgumentParser(prog='steganalysis-parity')
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 = steganalysisParity.steganalyse(input_image_file)
output_image.save(options.output_image_file)
output_image.save(arguments.output_image_file)

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)