程序代写代做 C graph Java game Problem Description

Problem Description
This section explains how steganographic encryption and decryption is performed on images. Make sure you understand the principles of the process before you attempt to implement a solution in Java.
Steganography terminologyThe shared image which will be used to carry your secret message is called thecoverimage. The termsecretis used for the greyscale image that you want to hide. You could use coloured secret messages, but they will be reduced to a black and white image and so you are likely to lose information. The encrypted image for transmission is called themessageimage. The message images contains the secret message but to the eye it should look the same as the cover image.
Encrypting a messagehas three steps. First we take a cover image and clear the low order bit of each RGB pixel. That is, we make the lowest bit zero. Each pixel has a red, green and blue value in the range 0 to 255. So clearing the low order bit is equivalent to quantizing the cover image so that it uses only 128 distinct values per pixel. This change is largely imperceptible to the eye. Call this quantized image coverQ. Second we reduce the range of pixel values used in the secret image from 0 to 255 to just 0 or 1 for each colour. This can be done by dividing each colour in the pixel by 128. Call this reduced image secretZ. Finally, add the reduced 0,1 secret image to the quantized cover image to create a coded message for sending. That is, message coverQ secretZ
Decrypting a coded messagereverses the encryption process. Get the low order bits from an encrypted message by applying modulo 2 operation to each colour pixel. Let this extracted 0,1 image be secretZ. Then scale the pixel values of secretZ by multiplying each colour value by 255 because looking at black images is not much fun. This should yield a twotone version of the secret image. Call this scalerecovered image secretS.
Adding ImagesFor our purposes, adding two images together is as simple as adding the corresponding colour values together for each pixel. Given two images of the same dimensions, we will create a new image where each pixel in the new image is exactly the sum of the pixels in the original images. If your images are prepared correctly, then adding operations will always give legal 0..255 pixel colour values.
Scaling ImagesThe colour pixel operations for generating coverQ, secretZ and secretS can each be defined using integer division and multiplications on each pixel colour. Recall that integer division in Java always produces another integer. As a result, consider what happens if we first divide a number by 10 and then immediately multiply the result by 10. The final result will always be the same as the original value with the rightmost digit replaced by a 0. For example, 354 divided by 10 is 35 and 35 times 10 is 350. Division by 2 in binary behaves the same way as division by 10 does in decimal. If we divide a binary number by 2 and then multiply by two, the result will be the same as simply replacing the last binary digit of the initial value with 0. In other words, we can clear the low order bit of a pixel by first dividing by 2 and then multiplying by 2. Quantizing cover to coverQ is done this way.Scaling secret to secretZ is done by integer division of each pixel by 128 and multiplying by 1. And scaling secretZ to secretS is done by dividing by 1 and multiplying by 255. On the other hand, extracting the low order bit from an encrypted message uses modulo 2 operator to return the low order bit which is the remainder after dividing by 2.
Image ManipulationThe Java librariesBufferedImageandColorwill be used for manipulating images. TheBufferedImagemethodint getRGBint x, int yreturns the value of the pixel at position x,y as an integer in the default RGB colour model TYPEINTARGB and default sRGB colourspace. Then useColor c new Color img.getRGBx,y;to convert the integer pixel value into a Color object. The colour parts of the pixel can then be accessed byc.getRed, c.getGreen, c.getBluewhich return the 0..255 integer value of each colour in the pixel. You will be manipulating these three colour pixels to encrypt and decrypt steganographic images.
To get started, you will need to read images from a file. Use theImageIOlibrary class for these tasks as described in the CITS1001 week 9 lab class for a way to do this.
Specification of Project Classes

The steganography project uses a modelviewcontroller design similar to the Game of Life example studied in class.
TheStegoViewerclass manages a display for showing four images: a cover, secret, encrypted message and decrypted secret. The display can created using methods of theSimpleCanvasclass provided. You should only require the constructor, drawImage and drawString methods from SimpleCanvas. Do not make any changes to the SimpleCanvas class because the provided class will be used to test your project.
TheStegoImageclass manages all the image manipulations required for steganography. Its methods transform the image by clearing bits, thresholding, and adding and subtracting images. Its constructor reads an image from a file.
TheStegoCoderclass is a utility class containing just two methods: one for encrypting and one for decrypting. Each method takes StegoImage objects as input and returns a StegoImage object.
StegoDemoprovides methods for running the application. It contains methods that run examples for creating, encoding and decoding stego messages. Call these methods to test your project code. You are welcome to extend the project by adding your own methods to this class.
You will make use of several Java library classes in this project. The following library classes are recommended. You should not require any others.java.awt.image.BufferedImagejava.awt.Colorjava.io.Filejava.io.IOExceptionjavax.imageio.ImageIO
Details of the methods required in each class are as follows. The first group of methods for each class phase 1 should be straightforward to implement, so it is recommended you complete and test those methods first. The second group of methods for each class phase 2 marked require more thought. Follow the specifications for error handling using System.out.println statements to report unchecked exceptions eg for missing files etc. Post any questions for clarification of the specifications to help1001, including the method name in the subject line.
StegoViewer class
Begin this project by implementing the user interface. Call your toplevel class StegoViewer. Use the SimpleCanvas class to create a viewer for 4 images each with height and width of 300. Your output should look something like this:

Use the following class variables to provide default values for the display.public static int IMGWIDTH 300;public static int IMGHEIGHT 300;public static int CAPTIONMARGIN 50;public static int NUMIMAGES 4;
StegoViewerIs the constructor for creating a stego display using the default values. Your canvas should have NUMIMAGES each of the same size of IMGWIDTH by IMGHEIGHT. CAPTIONMARGIN pixels are allowed below each image for writing captions.
void displayImageBufferedImage image, int windowThis method displays its parameter image in one of the 4 windows of the canvas. Use window 0 for the cover image, 1 for the secret, 2 for the encrypted message and 3 for the decrypted secret. For example,displayImagecoverimage, 0;should display the cover image in the leftmost window anddisplayImagefoundsecret, 3;should display the decrypted secret image in the rightmost window.
StegoImage class
The StegoImage class implements methods for creating a single image and transforming that image by manipulating the RGB values of each of its pixels. Read the Problem Description section carefully before implementing this class.
Three fields calledimage, width, heightwith typesBufferedImage, int, intrespectively.
A constructorStegoImageString filenameto create a StegoImage by reading an image from a file. The constructor should also set the width and height fields from the read image.
Three getter methods:getImage, getWidth, getHeightto return the field values of the class.
void scaleImageint div, int multModify this image by changing every pixel by scaling its red, green, blue components as described in the Problem Description section. Each pixel is modified by dividing by div then multiplying by mult.
void clearLowBitModify this image by setting the lowest bit of each pixel colour to 0.
void setZeroOneModify this image by thresholding its pixels to 0 or 1 in each pixel colour.
void setBlackWhiteModify this image by upscaling each 0,1 pixel to a greyscale for viewing.
void setToLowBitModify this image by setting each pixel to just its low bit value 0 or 1.
void mergeImageStegoImage newimageModify this image to become this newimage by adding each of their RGB pixels.
StegoCoder class
The StegoCoder class is a utility class that provides methods for the encryption and decryption of images.
This class has no field variables and the constructor body should be empty. It is a utility class like Math.
StegoImage encryptStegoImage cover, StegoImage secretReturn a new message by hiding a secret in the cover image.
StegoImage decryptStegoImage messageReturn a decryption of the received message by extracting and then upscaling its low bits.