Name: _____________________ Netid: _________________This week's recitation covers three things:
Picture class that's
used in Steganography. What are the three individual
RGB values returned in
the Color/Pixel value from the method reduce when the
parameter passed to it has RGB values (40, 102, 13)?
main. Write a header for a method that will
take the source image, the target image, and the number of bits that the
user enters and
that will return a new image in which the source is embedded or hidden
in the target. Write just the method header or prototype --
call the method getHiddenPicture
HideText
modeled on the HideImage class. In
recitation you'll go over how to start writing from scratch the
HideText class by copy/pasting to get things going.
[78,100] where values are
shown in binary as:
[01001110, 01100100] the method would return an
8-byte array with the following values
[01, 00, 11, 10, 01, 10, 01, 00]. Creating this new array
will
make it easier to hide the two-bit chunks in an image. Your program
won't deal explicitly with binary values. To get the two-bit
chunks you'll just mod/% by 4 and then divide by 4 to get each
chunk.
For example, the binary value 01001110 above is 78. If you repeatedly mod and div by 4 starting with 78 you get:
78 % 4 = 2 store 2 bit chunk
78 / 4 = 19
19 % 4 = 3 store 2 bit chunk
19 / 4 = 4
4 % 4 = 0 store 2 bit chunk
4 / 4 = 1
1 % 4 = 1 store 2 bit cunk
As you can see, the value 78 yields chunks [2,3,0,1] which
in reverse order (most significant chunk to least) are 1,0,3,2
which
in binary are 01, 00, 11, 10. Of course you write your program thinking
about 78, not thinking about 01001110. You get the value 78 from
a byte array.
Write the method below which returns 2-bit chunks obtained from "chopping" them out of an array of byte/8-bit values. The new array will contain four times as many values (why?). The bit-chunks should be stored in the same order, i.e., most significant first. Look at the example above.
// return all 2-bit chunks, in same order, from array public byte[] chunkize(byte[] array)