mirror of
https://github.com/cedricbonhomme/Stegano.git
synced 2025-05-13 09:28:31 +02:00
Update steganalysis functions.
This commit is contained in:
parent
d3d03c2f74
commit
0d1c5cc4c1
4 changed files with 18 additions and 38 deletions
|
@ -20,9 +20,9 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>
|
# along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
|
||||||
__author__ = "Cedric Bonhomme"
|
__author__ = "Cedric Bonhomme"
|
||||||
__version__ = "$Revision: 0.5.1 $"
|
__version__ = "$Revision: 0.6 $"
|
||||||
__date__ = "$Date: 2016/03/18 $"
|
__date__ = "$Date: 2016/03/18 $"
|
||||||
__revision__ = "$Date: 2016/05/22 $"
|
__revision__ = "$Date: 2016/08/04 $"
|
||||||
__license__ = "GPLv3"
|
__license__ = "GPLv3"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>
|
# along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
|
||||||
__author__ = "Cedric Bonhomme"
|
__author__ = "Cedric Bonhomme"
|
||||||
__version__ = "$Revision: 0.5 $"
|
__version__ = "$Revision: 0.6 $"
|
||||||
__date__ = "$Date: 2016/03/18 $"
|
__date__ = "$Date: 2016/08/04 $"
|
||||||
__license__ = "GPLv3"
|
__license__ = "GPLv3"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -31,16 +31,14 @@ except:
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
from optparse import OptionParser
|
import argparse
|
||||||
parser = OptionParser()
|
parser = argparse.ArgumentParser(prog='steganalysis-parity')
|
||||||
parser.add_option("-i", "--input", dest="input_image_file",
|
parser.add_argument("-i", "--input", dest="input_image_file",
|
||||||
help="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")
|
help="Image file")
|
||||||
parser.set_defaults(input_image_file = './pictures/Lenna.png',
|
arguments = parser.parse_args()
|
||||||
output_image_file = './pictures/Lenna_steganalysed.png')
|
|
||||||
(options, args) = 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 = steganalysisParity.steganalyse(input_image_file)
|
||||||
output_image.save(options.output_image_file)
|
output_image.save(arguments.output_image_file)
|
||||||
|
|
|
@ -50,19 +50,3 @@ def steganalyse(img):
|
||||||
b = 255
|
b = 255
|
||||||
encoded.putpixel((col, row), (r, g , b))
|
encoded.putpixel((col, row), (r, g , b))
|
||||||
return encoded
|
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)
|
|
||||||
|
|
|
@ -55,16 +55,14 @@ def steganalyse(img):
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# Point of entry in execution mode.
|
# Point of entry in execution mode.
|
||||||
from optparse import OptionParser
|
import argparse
|
||||||
parser = OptionParser()
|
parser = argparse.ArgumentParser(prog='steganalysis-statistics')
|
||||||
parser.add_option("-i", "--input", dest="input_image_file",
|
parser.add_argument("-i", "--input", dest="input_image_file",
|
||||||
help="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.")
|
help="Image file.")
|
||||||
parser.set_defaults(input_image_file = './pictures/Lenna.png',
|
arguments = parser.parse_args()
|
||||||
output_image_file = './pictures/Lenna_steganalysed.png')
|
|
||||||
(options, args) = 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)
|
output_image = steganalyse(input_image_file)
|
||||||
soutput_image.save(options.output_image_file)
|
soutput_image.save(arguments.output_image_file)
|
||||||
|
|
Loading…
Add table
Reference in a new issue