create c++ code
Assignment 3 - Digital Watermarking - V4 Assignment 3: Computer Engineering Case Study – Image Steganography Available: October 24th, 2020 Due: November 14th, 2020 Programming aspects to get familiarized with: Ø The use of multidimensional arrays and pointers. Ø Dynamic memory allocation and deallocation. Background A watermark adds information to a document or image by placing a logo or seal in plain sight. The watermark protects the owner’s rights by showing ownership. TV broadcasters commonly do this by placing their logo in a corner of the broadcast picture. A watermark can be hidden in an image. Hiding the watermark does not change the appearance of the image. This protects the owner’s rights, without disturbing the image. Steganography is a technique of hiding the data (file, text, image, etc.) within another data file (file, text, image, etc.). In this assignment you are required to implement a solution for digital image steganography. You are required to develop a software solution to encode a secret text message inside a Bitmap image and decode the secret message by extracting the embedded message from the encoded image. More information about steganography can be found in the following Wikipedia article. The Task Assume an image is represented as a three-dimensional array (M-by-N-by-3 array) where M is the number of pixels in the vertical direction (rows) and N is the number of pixels in the horizontal direction(cols), while each 3-vector corresponds to the blue, green, and red intensities of each pixel. The pixel values are 1-byte characters and are between 0 and 255. A “BitmapHelper” header script is provided with this document to read Bitmap images (.bmp) into a 3D image array and to write Bitmap image (.bmp) to an image file. A bitmap image has the following structure. Size Contents 14 bytes Bitmap File header 40 bytes Bitmap info header (variable) Color palette (variable) Bitmap pixel array Refer to Wikipedia article for more information on bitmap file structure and different variations/versions. A Bitmap pixel array is arranged in the format given below (by default the pixels are arranged in BGR order). A bitmap file BGR pixel data can be read in an unsigned char*** array using BitmapHelper. The signatures for the read/write functions are given below. //Signature for Read Function bool ReadBitmapImage(const char* fileName, unsigned char*** &imageData, int& imageWidth, int& imageHeight); //Signature for Write Function bool WriteBitmapImage(const char* fileName, unsigned char*** imageData, int imageWidth, int imageHeight); Read the secret message to hide from the standard input. You are required to implement the Least Significant Bit (LSB) image steganography where message bits are hidden in the least significant bit of image bytes to have minimal visible effect so it is not recognizable for a common viewer. An example of hiding one character to image pixels is illustrated through the following example. ( 0 , h-1 ) ( 1 , h-1 ) ( 2 , h-1 ) ( 3 , h-1 ) ( 4 , h-1 ) ( 5 , h-1 ) … ( w-3, h-1 ) (w-2 , h-1 ) ( w-1 , h-1 ) Padding … . . . . . . … . . . . . . … . . . . . . . . . Padding ( 0 , 4 ) ( 1 , 4 ) ( 2 , 4 ) ( 3 , 4 ) ( 4 , 4 ) ( 5 , 4 ) … ( w-3, 4) (w-2 , 4) ( w-1 , 4) Padding ( 0 , 3) ( 1 , 3) ( 2 , 3 ) ( 3 , 3 ) ( 4 , 3) ( 5 , 3 ) … ( w-3, 3) (w-2 , 3) ( w-1 , 3) Padding ( 0 , 2 ) ( 1 , 2 ) ( 2 , 2 ) ( 3 , 2 ) ( 4 , 2 ) ( 5 , 2 ) … ( w-3, 2) (w-2 , 2) ( w-1 , 2) Padding ( 0 , 1) ( 1 , 1) ( 2 , 1 ) ( 3 , 1 ) ( 4 , 1) ( 5 , 1 ) … ( w-3, 1) (w-2 , 1) ( w-1 , 1) Padding ( 0 , 0 ) ( 1 , 0 ) ( 2 , 0 ) ( 3 , 0 ) ( 4 , 0 ) ( 5 , 0 ) … ( w-3, 0) (w-2 , 0) ( w-1 , 0) Padding Bitmap pixels arrangement H eight Width x 3 Width H eight Blue Green Red Blue Green Red Blue Green Red 01100010 00100110 00111000 01110001 01001010 01000111 01100010 10100011 11000110 Binary Blue Green Red Blue Green Red Blue Green Red 01100011 00100111 00111000 01110001 01001010 01000110 01100011 10100010 11000110 1 1 0 1 0 0 1 0 11000110 LSB MSB Original pixel bytes New pixel bytes Pixel 3 (MSB) 0 1 0 0 1 0 1 1 (LSB) To Hide One Character 'K' Pixel 1 Pixel 2 Pixel 2Pixel 1 Pixel 3 At the end of the secret message a delimiter character ‘\0’ should be embedded to pixel bytes so the message can be extracted back in the decode process. You are required to implement Encode, Decode and ReleaseMemory subprograms (functions) in your solution. The Software Notes on the use of global variables, arrays, matrices, and symbolic constants: Ø Array and matrix dimensions should be given as symbolic constants. Such definitions should be used to declare arrays and matrices. Ø When passing an array to a function, pass the dimension as an argument. When passing a matrix (2D array) to a function, pass the row dimension as an argument. In the case of matrices, it is necessary to use the symbolic constant for the column dimension in the parameter declaration of a function definition. Ø You must use the BitmapHelper.h header file to read/write bitmap images. The file has a function named ReleaseMemory() that must be completed. Ø ReleaseMemory() function is responsible for releasing the dynamic memory allocated by BitmapHelper.h functions and should be called appropriately. Ø Sample bitmap images files are attached with the problem statement for testing/verification purpose. Ø Create a modular design of your solution (dividing the program into reusable functions). Ø You must arrange your solution into separate header files for encoding and decoding the secret text messages: Decoder.h and Encoder.h. Develop a software that provides the user with options to encode and decode images. The software presents the user with a main menu, with options to encode a message, decode a message, and exit the program. When the user selects the encode option, he/she is prompted to enter the secret message and the name of the bitmap file where the secret message must be encoded in. When the user selects the decode option, the program prompts the user for the encoded bitmap image name, extracts the secret test message, and display it on the output screen. When the user selects the exit option, a message confirming exit is printed on the screen and the program is terminated. Write your report using the five steps model for software development (as discussed in class): a) Step 1: Problem Identification and Statement (5 points) b) Step 2: Gathering Information (10 points) c) Step 3: Test Cases and algorithm (35 points) d) Step 4: Code or implementation (35 points) e) Step 5: Test and Verification (15 points)