SlideShare a Scribd company logo
1 of 3
Download to read offline
Hello, I was wondering if you can help with the code required of me to do this project. I've been
trying to do this on my own but i've been struggling to get the code working properly on my text
editor or even have an image appear. If you can help with this, that would awesome. I've also
included the docoding code in case you may need it. Thank you and I hope this works out.
Project 2: Matrix Operations and Steganography 1. Goals To use elementary matrix operations to
perform steganography and hide text inside the pixels of an image. 2. Introduction Recall that an
image in a computer memory can be stored as a matrix with each position in the matrix
representing a single pixel of the entire image, and the values of each position corresponding to
the combination of Red, Green, and Blue light that the single pixel will emit. Knowing that an
image is stored as a matrix with values ranging from 0 to 255 we can then apply our knowledge
about linear transformations to these matrices and hide text inside the image. 3. Tasks This
project will not include a walk-through like project 1 did. This project will build on the ideas and
methods from Project 1 , but will require you to devise your own code. Your task is: 1. Obtain a
picture of yourself (for example, the picture from your FSU card which can be obtained by
signing into my.fsu.edu, navigating to "myFSU identity management," and clicking "My
Profile") and convert it into a lossless image format (most likely a png). 2. Use Python3 to open
the picture and create a matrix M consisting of the RGB-saturation (or simply RBG if you prefer,
but not just grayscale) values of the pixels. 3. Create a string consisting of your name and the
answers to the questions in the next section. This string might look like: b"JaredMiller. Yes, this
is bijective because..." It is important to include the ' b ' in front and the quotation marks, as this
tells Python how to convert your text into a number in the next step. 4. Convert the string to a
number by encoding the bytes. To do this in Python3, use the following code (with your own
name and answers to the questions from later on): message =b" JaredMiller. Yes, this is bijective
because..." encoded =" for byte in message: encoded += format (byte, ' 08b ')
Project 1 2 Now encoded represents the number which you should hide in your picture. 5.
Modify your code from project 1 (or modify my decoding code below) to produce a program
which will hide the encoded message from step 4 in the following way: (1) Find the length of
your encoded message encoded (how many 0's and 1's there are) and call this . (2) Find how
many pixels are in your picture and call this p. (3) Let f be defined as the floor of p/, that is, f:=p
(4) Let frequency be defined as the smallest integer power of 2 which is greater than f (so if f is
195 , then frequency is 28=256 ). Note that 20=1, so a frequency of 1 is acceptable if you have a
long message. (5) Number the pixels starting at the top left, from left to right and then top to
bottom just as you read, with the top left pixel being pixel 0 . Let the number of each pixel with
this numbering be its position. That is, position:=rowwidth+column where the first row is row 0
and the first column is column 0 . (6) You will modify every pixel whose position is an integer
multiple of your frequency (including 0 ). The remaining steps only apply to pixels which are to
be modified. (7) For pixels that are to be modified, take the R, G, and B values of the pixel and
determine if their sum is even or odd. (8) Determine if the parity of the sum of R, G, and B
values equals the parity of the next bit of your encoded message (the next 0 or 1 ). If so, do not
modify that pixel. If not, then randomly select (or algorighmically, but do not always select the
same one) one of the RGB values and: (a) if it is even, add 1 to it (b) if it is odd subtract 1 from
it. This will make the parity of the sum of R,G, and B values equal the parity of the next bit of
your encoded message. (9) Update the pixels accordingly. (10) Save your picture and test it with
the code below, which I will use to decode.
Answer the following questions and include them in your message which will be hidden. Make
sure that your answers are not so long that the length of your encoded string exceeds the number
of pixels in your picture. The picture from myFSU is 99000 pixels, so you can store a hidden
message of 99000/8=12,375 characters long (approximately 2000 words). (1) Is the process of
steganography as we have done it an injective mapping between pictures of a given size?
Surjective? What limitations might we have for each? Explain. (2) Without knowing the length
of your message, how might I determine the frequency of the modified pixels? (3) As the RGB-
saturation values essentially encode pixels as vectors in (F255)4 and the matrix has mn pixels,
we know that this matrix represents an element in the vector space (F255)4mn. For a given
picture size, which hidden messages correspond to a mapping in which the image of the space of
all pictures is a vector subspace?
Project 1 5. The program I will use to decode I will use your modified picture with file name
'hidden.png' as the input for the following program in Python 3 . The output of this should be
your intended message from step 3 above, without the leading b or the quotation marks, and with
some nonsense added to the end (if your message doesn't exactly fill the matrix based on your
frequency, which is likely). image - 'hidden.png' # Yust be a png (or other lossless) frequency -
24+6 # May change exponent, to fit message length def unhide(inage, frequency): # Import
module that will bandle opening the inage from PIL import Image # Open the inage in - Inage
.open(image) pixelMap - in. load () # Get the individual pixels ing - Inage , new ( im. node,
in.size) pixelsNen - ing.load() # Empty encoded message (each letter as eight 0s or 1's) encoded
= 111 # Get the size of the image width - img. size [0] height - img. size [1] pixels -
vidth*height # Work over every row for j in range(height): # Work over the columis in that row
for i in range (width): # Get RGB and saturation values of pixel (i,j)a,b,c,dpixelMap[i,j] # If it
is in a position which is to be # used for hiding the message position - j*width+i if
position%frequency =0 : # Grab the added information # (only added to one of R,G, or B) info
=(a+b+c)%2 if info >1 : return "Your data was not compatible or 1+1 "your nessage length is
incorrect" # Add it to the encoded message encoded +- str (info) # Stop editing the picture in.
close() # Split the nessage up based on its sections of eight 0 's or 1's encodedArray - [encoded
[8i:8i+8] for i in range(len(encoded) //8)] # Blank decoded message that we will add to decoded
- II # Convert the binary (the 2 denotes base 2) into letters for letter in encodedarray: decoded +-
chr ( int ( letter, 2)) #print(encoded) return decoded unhide(image, frequency)

More Related Content

Similar to Hello, I was wondering if you can help with the code required of me .pdf

JonathanWestlake_ComputerVision_Project1
JonathanWestlake_ComputerVision_Project1JonathanWestlake_ComputerVision_Project1
JonathanWestlake_ComputerVision_Project1
Jonathan Westlake
 
Image processing basics using matlab
Image processing basics using matlabImage processing basics using matlab
Image processing basics using matlab
Ankur Tyagi
 
Image processing
Image processingImage processing
Image processing
maheshpene
 
We are restricted from importing cv2 numpy stats and other.pdf
We are restricted from importing cv2 numpy stats and other.pdfWe are restricted from importing cv2 numpy stats and other.pdf
We are restricted from importing cv2 numpy stats and other.pdf
DARSHANACHARYA13
 

Similar to Hello, I was wondering if you can help with the code required of me .pdf (20)

JonathanWestlake_ComputerVision_Project1
JonathanWestlake_ComputerVision_Project1JonathanWestlake_ComputerVision_Project1
JonathanWestlake_ComputerVision_Project1
 
Image processing basics using matlab
Image processing basics using matlabImage processing basics using matlab
Image processing basics using matlab
 
Data Science - Part XVII - Deep Learning & Image Processing
Data Science - Part XVII - Deep Learning & Image ProcessingData Science - Part XVII - Deep Learning & Image Processing
Data Science - Part XVII - Deep Learning & Image Processing
 
Image processing using matlab
Image processing using matlabImage processing using matlab
Image processing using matlab
 
Digital Watermarking through Embedding of Encrypted and Arithmetically Compre...
Digital Watermarking through Embedding of Encrypted and Arithmetically Compre...Digital Watermarking through Embedding of Encrypted and Arithmetically Compre...
Digital Watermarking through Embedding of Encrypted and Arithmetically Compre...
 
Matlab dip
Matlab dipMatlab dip
Matlab dip
 
Image to Text Converter
Image to Text ConverterImage to Text Converter
Image to Text Converter
 
BMVA summer school MATLAB programming tutorial
BMVA summer school MATLAB programming tutorialBMVA summer school MATLAB programming tutorial
BMVA summer school MATLAB programming tutorial
 
Programming in matlab lesson5
Programming in matlab lesson5Programming in matlab lesson5
Programming in matlab lesson5
 
An Image Steganography Algorithm Using Huffman and Interpixel Difference Enco...
An Image Steganography Algorithm Using Huffman and Interpixel Difference Enco...An Image Steganography Algorithm Using Huffman and Interpixel Difference Enco...
An Image Steganography Algorithm Using Huffman and Interpixel Difference Enco...
 
Report_NLNN
Report_NLNNReport_NLNN
Report_NLNN
 
Image processing
Image processingImage processing
Image processing
 
We are restricted from importing cv2 numpy stats and other.pdf
We are restricted from importing cv2 numpy stats and other.pdfWe are restricted from importing cv2 numpy stats and other.pdf
We are restricted from importing cv2 numpy stats and other.pdf
 
Image Steganography Techniques
Image Steganography TechniquesImage Steganography Techniques
Image Steganography Techniques
 
Image steganography techniques
Image steganography techniquesImage steganography techniques
Image steganography techniques
 
IRJET- Machine Learning Application for Data Security
IRJET- Machine Learning Application for Data SecurityIRJET- Machine Learning Application for Data Security
IRJET- Machine Learning Application for Data Security
 
Image processing with matlab
Image processing with matlabImage processing with matlab
Image processing with matlab
 
Image Classification using Deep Learning
Image Classification using Deep LearningImage Classification using Deep Learning
Image Classification using Deep Learning
 
Introducing the Concept of Back-Inking as an Efficient Model for Document Ret...
Introducing the Concept of Back-Inking as an Efficient Model for Document Ret...Introducing the Concept of Back-Inking as an Efficient Model for Document Ret...
Introducing the Concept of Back-Inking as an Efficient Model for Document Ret...
 
A Novel Method for Image Watermarking Using Luminance Based Block Selection a...
A Novel Method for Image Watermarking Using Luminance Based Block Selection a...A Novel Method for Image Watermarking Using Luminance Based Block Selection a...
A Novel Method for Image Watermarking Using Luminance Based Block Selection a...
 

More from aggarwalshoppe14

I really need some help if I have this right so far. Please Resub.pdf
I really need some help if I have this right so far. Please Resub.pdfI really need some help if I have this right so far. Please Resub.pdf
I really need some help if I have this right so far. Please Resub.pdf
aggarwalshoppe14
 
I really need some help if I have this right so far. PLEASE CHANG.pdf
I really need some help if I have this right so far. PLEASE CHANG.pdfI really need some help if I have this right so far. PLEASE CHANG.pdf
I really need some help if I have this right so far. PLEASE CHANG.pdf
aggarwalshoppe14
 
I need this code, to show ALL inventory items, then with the remove .pdf
I need this code, to show ALL inventory items, then with the remove .pdfI need this code, to show ALL inventory items, then with the remove .pdf
I need this code, to show ALL inventory items, then with the remove .pdf
aggarwalshoppe14
 
I need help with the last 2 methods only in Huffman.java file the me.pdf
I need help with the last 2 methods only in Huffman.java file the me.pdfI need help with the last 2 methods only in Huffman.java file the me.pdf
I need help with the last 2 methods only in Huffman.java file the me.pdf
aggarwalshoppe14
 
I need help creating this flutter applicationPlease provide a com.pdf
I need help creating this flutter applicationPlease provide a com.pdfI need help creating this flutter applicationPlease provide a com.pdf
I need help creating this flutter applicationPlease provide a com.pdf
aggarwalshoppe14
 
Hile ��geni bileenlerini a�klar. Tannm bir kriminolog olan Donald .pdf
Hile ��geni bileenlerini a�klar. Tannm bir kriminolog olan Donald .pdfHile ��geni bileenlerini a�klar. Tannm bir kriminolog olan Donald .pdf
Hile ��geni bileenlerini a�klar. Tannm bir kriminolog olan Donald .pdf
aggarwalshoppe14
 
Hi could I get the java code for all the tasks pls, many thanks!.pdf
Hi could I get the java code for all the tasks pls, many thanks!.pdfHi could I get the java code for all the tasks pls, many thanks!.pdf
Hi could I get the java code for all the tasks pls, many thanks!.pdf
aggarwalshoppe14
 
Here is app.js, artist.js and songs.js file. Can you look at the my .pdf
Here is app.js, artist.js and songs.js file. Can you look at the my .pdfHere is app.js, artist.js and songs.js file. Can you look at the my .pdf
Here is app.js, artist.js and songs.js file. Can you look at the my .pdf
aggarwalshoppe14
 
Here are the instructions and then the code in a sec. Please R.pdf
Here are the instructions and then the code in a sec. Please R.pdfHere are the instructions and then the code in a sec. Please R.pdf
Here are the instructions and then the code in a sec. Please R.pdf
aggarwalshoppe14
 
help write program Project Desoription The purpose of thi project i.pdf
help write program Project Desoription The purpose of thi project i.pdfhelp write program Project Desoription The purpose of thi project i.pdf
help write program Project Desoription The purpose of thi project i.pdf
aggarwalshoppe14
 
I need a case analysis using Harvards Business School format please.pdf
I need a case analysis using Harvards Business School format please.pdfI need a case analysis using Harvards Business School format please.pdf
I need a case analysis using Harvards Business School format please.pdf
aggarwalshoppe14
 

More from aggarwalshoppe14 (20)

I am sure you have heard the adage �my word is my bond�. We do not k.pdf
I am sure you have heard the adage �my word is my bond�. We do not k.pdfI am sure you have heard the adage �my word is my bond�. We do not k.pdf
I am sure you have heard the adage �my word is my bond�. We do not k.pdf
 
I really need some help if I have this right so far. Please Resub.pdf
I really need some help if I have this right so far. Please Resub.pdfI really need some help if I have this right so far. Please Resub.pdf
I really need some help if I have this right so far. Please Resub.pdf
 
I receive this answer for one of my questions, I need the reference .pdf
I receive this answer for one of my questions, I need the reference .pdfI receive this answer for one of my questions, I need the reference .pdf
I receive this answer for one of my questions, I need the reference .pdf
 
I really need some help if I have this right so far. PLEASE CHANG.pdf
I really need some help if I have this right so far. PLEASE CHANG.pdfI really need some help if I have this right so far. PLEASE CHANG.pdf
I really need some help if I have this right so far. PLEASE CHANG.pdf
 
I need this code, to show ALL inventory items, then with the remove .pdf
I need this code, to show ALL inventory items, then with the remove .pdfI need this code, to show ALL inventory items, then with the remove .pdf
I need this code, to show ALL inventory items, then with the remove .pdf
 
I need help with the last 2 methods only in Huffman.java file the me.pdf
I need help with the last 2 methods only in Huffman.java file the me.pdfI need help with the last 2 methods only in Huffman.java file the me.pdf
I need help with the last 2 methods only in Huffman.java file the me.pdf
 
I need help creating this flutter applicationPlease provide a com.pdf
I need help creating this flutter applicationPlease provide a com.pdfI need help creating this flutter applicationPlease provide a com.pdf
I need help creating this flutter applicationPlease provide a com.pdf
 
His Majesty�s Government report that 20 of officials arrive late fo.pdf
His Majesty�s Government report that 20 of officials arrive late fo.pdfHis Majesty�s Government report that 20 of officials arrive late fo.pdf
His Majesty�s Government report that 20 of officials arrive late fo.pdf
 
HIVin RNA genomu, bir RNA ablonundan bir DNA genomunu sentezlemek i.pdf
HIVin RNA genomu, bir RNA ablonundan bir DNA genomunu sentezlemek i.pdfHIVin RNA genomu, bir RNA ablonundan bir DNA genomunu sentezlemek i.pdf
HIVin RNA genomu, bir RNA ablonundan bir DNA genomunu sentezlemek i.pdf
 
Hile ��geni bileenlerini a�klar. Tannm bir kriminolog olan Donald .pdf
Hile ��geni bileenlerini a�klar. Tannm bir kriminolog olan Donald .pdfHile ��geni bileenlerini a�klar. Tannm bir kriminolog olan Donald .pdf
Hile ��geni bileenlerini a�klar. Tannm bir kriminolog olan Donald .pdf
 
Hi, I need help with this Probability question. Please show work and.pdf
Hi, I need help with this Probability question. Please show work and.pdfHi, I need help with this Probability question. Please show work and.pdf
Hi, I need help with this Probability question. Please show work and.pdf
 
Hi could I get the java code for all the tasks pls, many thanks!.pdf
Hi could I get the java code for all the tasks pls, many thanks!.pdfHi could I get the java code for all the tasks pls, many thanks!.pdf
Hi could I get the java code for all the tasks pls, many thanks!.pdf
 
HHI analysis indicates that many states have a highly concentrated i.pdf
HHI analysis indicates that many states have a highly concentrated i.pdfHHI analysis indicates that many states have a highly concentrated i.pdf
HHI analysis indicates that many states have a highly concentrated i.pdf
 
Hello I need help configuring the regression equation for this scatt.pdf
Hello I need help configuring the regression equation for this scatt.pdfHello I need help configuring the regression equation for this scatt.pdf
Hello I need help configuring the regression equation for this scatt.pdf
 
Health Economics with Taxation and Agrarian ReformActivity 2 Grap.pdf
Health Economics with Taxation and Agrarian ReformActivity 2 Grap.pdfHealth Economics with Taxation and Agrarian ReformActivity 2 Grap.pdf
Health Economics with Taxation and Agrarian ReformActivity 2 Grap.pdf
 
Here is app.js, artist.js and songs.js file. Can you look at the my .pdf
Here is app.js, artist.js and songs.js file. Can you look at the my .pdfHere is app.js, artist.js and songs.js file. Can you look at the my .pdf
Here is app.js, artist.js and songs.js file. Can you look at the my .pdf
 
Here is a short amino acid sequence mapped as polar (P) and nonpolar.pdf
Here is a short amino acid sequence mapped as polar (P) and nonpolar.pdfHere is a short amino acid sequence mapped as polar (P) and nonpolar.pdf
Here is a short amino acid sequence mapped as polar (P) and nonpolar.pdf
 
Here are the instructions and then the code in a sec. Please R.pdf
Here are the instructions and then the code in a sec. Please R.pdfHere are the instructions and then the code in a sec. Please R.pdf
Here are the instructions and then the code in a sec. Please R.pdf
 
help write program Project Desoription The purpose of thi project i.pdf
help write program Project Desoription The purpose of thi project i.pdfhelp write program Project Desoription The purpose of thi project i.pdf
help write program Project Desoription The purpose of thi project i.pdf
 
I need a case analysis using Harvards Business School format please.pdf
I need a case analysis using Harvards Business School format please.pdfI need a case analysis using Harvards Business School format please.pdf
I need a case analysis using Harvards Business School format please.pdf
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 

Hello, I was wondering if you can help with the code required of me .pdf

  • 1. Hello, I was wondering if you can help with the code required of me to do this project. I've been trying to do this on my own but i've been struggling to get the code working properly on my text editor or even have an image appear. If you can help with this, that would awesome. I've also included the docoding code in case you may need it. Thank you and I hope this works out. Project 2: Matrix Operations and Steganography 1. Goals To use elementary matrix operations to perform steganography and hide text inside the pixels of an image. 2. Introduction Recall that an image in a computer memory can be stored as a matrix with each position in the matrix representing a single pixel of the entire image, and the values of each position corresponding to the combination of Red, Green, and Blue light that the single pixel will emit. Knowing that an image is stored as a matrix with values ranging from 0 to 255 we can then apply our knowledge about linear transformations to these matrices and hide text inside the image. 3. Tasks This project will not include a walk-through like project 1 did. This project will build on the ideas and methods from Project 1 , but will require you to devise your own code. Your task is: 1. Obtain a picture of yourself (for example, the picture from your FSU card which can be obtained by signing into my.fsu.edu, navigating to "myFSU identity management," and clicking "My Profile") and convert it into a lossless image format (most likely a png). 2. Use Python3 to open the picture and create a matrix M consisting of the RGB-saturation (or simply RBG if you prefer, but not just grayscale) values of the pixels. 3. Create a string consisting of your name and the answers to the questions in the next section. This string might look like: b"JaredMiller. Yes, this is bijective because..." It is important to include the ' b ' in front and the quotation marks, as this tells Python how to convert your text into a number in the next step. 4. Convert the string to a number by encoding the bytes. To do this in Python3, use the following code (with your own name and answers to the questions from later on): message =b" JaredMiller. Yes, this is bijective because..." encoded =" for byte in message: encoded += format (byte, ' 08b ') Project 1 2 Now encoded represents the number which you should hide in your picture. 5. Modify your code from project 1 (or modify my decoding code below) to produce a program which will hide the encoded message from step 4 in the following way: (1) Find the length of your encoded message encoded (how many 0's and 1's there are) and call this . (2) Find how many pixels are in your picture and call this p. (3) Let f be defined as the floor of p/, that is, f:=p (4) Let frequency be defined as the smallest integer power of 2 which is greater than f (so if f is 195 , then frequency is 28=256 ). Note that 20=1, so a frequency of 1 is acceptable if you have a long message. (5) Number the pixels starting at the top left, from left to right and then top to bottom just as you read, with the top left pixel being pixel 0 . Let the number of each pixel with this numbering be its position. That is, position:=rowwidth+column where the first row is row 0
  • 2. and the first column is column 0 . (6) You will modify every pixel whose position is an integer multiple of your frequency (including 0 ). The remaining steps only apply to pixels which are to be modified. (7) For pixels that are to be modified, take the R, G, and B values of the pixel and determine if their sum is even or odd. (8) Determine if the parity of the sum of R, G, and B values equals the parity of the next bit of your encoded message (the next 0 or 1 ). If so, do not modify that pixel. If not, then randomly select (or algorighmically, but do not always select the same one) one of the RGB values and: (a) if it is even, add 1 to it (b) if it is odd subtract 1 from it. This will make the parity of the sum of R,G, and B values equal the parity of the next bit of your encoded message. (9) Update the pixels accordingly. (10) Save your picture and test it with the code below, which I will use to decode. Answer the following questions and include them in your message which will be hidden. Make sure that your answers are not so long that the length of your encoded string exceeds the number of pixels in your picture. The picture from myFSU is 99000 pixels, so you can store a hidden message of 99000/8=12,375 characters long (approximately 2000 words). (1) Is the process of steganography as we have done it an injective mapping between pictures of a given size? Surjective? What limitations might we have for each? Explain. (2) Without knowing the length of your message, how might I determine the frequency of the modified pixels? (3) As the RGB- saturation values essentially encode pixels as vectors in (F255)4 and the matrix has mn pixels, we know that this matrix represents an element in the vector space (F255)4mn. For a given picture size, which hidden messages correspond to a mapping in which the image of the space of all pictures is a vector subspace? Project 1 5. The program I will use to decode I will use your modified picture with file name 'hidden.png' as the input for the following program in Python 3 . The output of this should be your intended message from step 3 above, without the leading b or the quotation marks, and with some nonsense added to the end (if your message doesn't exactly fill the matrix based on your frequency, which is likely). image - 'hidden.png' # Yust be a png (or other lossless) frequency - 24+6 # May change exponent, to fit message length def unhide(inage, frequency): # Import module that will bandle opening the inage from PIL import Image # Open the inage in - Inage .open(image) pixelMap - in. load () # Get the individual pixels ing - Inage , new ( im. node, in.size) pixelsNen - ing.load() # Empty encoded message (each letter as eight 0s or 1's) encoded = 111 # Get the size of the image width - img. size [0] height - img. size [1] pixels - vidth*height # Work over every row for j in range(height): # Work over the columis in that row for i in range (width): # Get RGB and saturation values of pixel (i,j)a,b,c,dpixelMap[i,j] # If it is in a position which is to be # used for hiding the message position - j*width+i if
  • 3. position%frequency =0 : # Grab the added information # (only added to one of R,G, or B) info =(a+b+c)%2 if info >1 : return "Your data was not compatible or 1+1 "your nessage length is incorrect" # Add it to the encoded message encoded +- str (info) # Stop editing the picture in. close() # Split the nessage up based on its sections of eight 0 's or 1's encodedArray - [encoded [8i:8i+8] for i in range(len(encoded) //8)] # Blank decoded message that we will add to decoded - II # Convert the binary (the 2 denotes base 2) into letters for letter in encodedarray: decoded +- chr ( int ( letter, 2)) #print(encoded) return decoded unhide(image, frequency)