Part A - 9 AM, Monday 9th September, 2002 (Start of Week
8)
Part B - 9 AM, Monday 21th October, 2002 (Start of
Week 13)
Demonstrations occur during Tute times within weeks 8 and 13.
The general aim of this semester's assignment is to gain experience with digital image manipulation. This will involve reading and writing binary image files, manipulating digital images and filtering those images. You will be required to write a program using Java which should run as an applet for part B, preferably from your home page.
Digital Image Watermarking has become very significant in dealing with digital objects on the internet. It is used to authenticate that a piece of multimedia is genuine or a forgery or cheap copy. Image watermarking is also used verify ownership of an image by secretly hiding a logo or other identifier so that you can prove ownership of this image. See more in the Digital Watermarking lecture in about week 7.
The specific aim of this assignment is to write a Java application which can be used to embed one image inside another 'host' image. The image that was embedded is called the watermark image (or just the 'watermark'). This application can later be used to read the embedded image from an image that was previously watermarked.
While the actual watermark embedding algorithm to be used is extremely simple (to detect, crack and to destroy), the primary purpose for this assignment is to show you how much information can be present in an image that you don't see.
A basic user interface is required. Drop down menus or buttons for selecting options are OK. Well designed or complicated interfaces will not receive extra marks as User Interface Design is not part of this course. The use of Swing or other high level libraries is allowed provided this is made clear in your documentation.
In order to embed an image into the host image, we must recode the host image to make room for the watermark image. In part A, we concentrate on image recoding.
As you learned in the Colour and Images and Applets lectures, an image
in Java is composed of pixels whose bits are in the form
AAAAAAAA RRRRRRRR GGGGGGGG BBBBBBBB, that is, 8 bits for each
of the alpha, R, G and B channels.
You must write a Java application that uses the ImageIO
library to read files of type 'jpg', 'gif', 'png'. You must then Recode them
as explained below, and save them ONLY as 'png' format image files. The 'png'
file format is 24-bit and non-lossy, and we need that for this assignment.
The image recoding involves zeroing up to 7 least significant bits (LSB)
from each of the R G B components of each pixel in the image, Then displaying
the resulting image as well as the original image and the "image difference"
between the two. So, for example, with three LSBs set to zero, each
resultant pixel will be of the form
AAAAAAAA RRRRR000 GGGGG000 BBBBB000. We thus effectively
truncate to multiples of 16 or 24 since the first
non-zero bit is 4th from the left in this case.
A problem with truncation is that, for example, the number 10011101 (157) and 10010001 (145) are truncated to the same value 10010000 (144). A minor alternative to the above is therefore to round up or down the pixel values instead of truncating them.
A more useful alternative to truncation or rounding is to use error diffusion. You will have learned about this in the Colour lecture as the Floyd-Steinberg (FS) method, but the Burke and Sierra method were also shown. Your program must implement FS or all 3 of these methods of error diffusion.
There are two related methods often used to quantify the difference between two similar images. Let's call the original image X, and the modified image Y, with both images having the same number of pixels and the same number of rows and columns. Note that we treat images as 1-dimensional arrays, just as in Java. The first difference measure is the Mean Square Error (MSE) which is defined as follows:

(1)
where N is the number of pixels in each image. This measures the average difference between corresponding pixels in X and Y.
The second difference measure between two images is usually used to quantify the amount of 'damage' to an image. So Y is a damaged version of X. This measure is called the Signal to Noise Ratio (SNR) and is defined as:

(2)
where R is a ratio > 1 that varies greatly in size and is hard to visualise.
It is conventional to express SNR in terms of decibels (dB). SNR was first used to describe sound intensity levels and so this is a logarithmic measure to mimic human hearing which is also logarithmic in its sensitivity. It has turned out to be a useful way to describe ratios when they can extend from something really tiny like 1010:1 to something enormous like 1:1010. But this is only -100 dB to +100 dB, a much easier set of numbers to deal with.
The above equation then becomes:
(3)
Your program must use these measures to plot a graph of MXY and SXY against the number of bits set to 0 (What sort of curve would you expect to see?).
A measure of how the pixel values in an image are distributed is the image histogram. This was explained in the Image Processing lecture. Your program must also produce a set of image histograms: one for each R, G and B channel; and also for L, a 'luminosity' channel which is defined as:
L = 27R + 53G + 11B)/100
(4)
L is a weighted average of R, G and B based on the relative sensitivity of our eyes to these three colours.
We now apply the image recoding methods developed in part A to implement an interesting watermarking algorithm - the reversible digital image.
The watermark algorithm is described in detail in a conference paper1 (supplied with the printed assignment sheet) by Keith T. Knox of Xerox Corp (and there is no online copy of this paper :) ). Keith presented this paper as a somewhat tongue-in-cheek method of embedding images.
"Simply reverse the image pixels, and you have the other one!"
The 'Knox' watermark has a surprisingly high information capacity for a watermarking algorithm. (the capacity refers to how much information can be stored in a watermark - in this case, an entire image).
The overall embedding procedure is as follows:
Horiginal(i) = 11111111 rrrrrrrr gggggggg bbbbbbbbwill be changed to
Hfiltered(i) = 11111111 rrrr0000 gggg0000 bbbb0000
Reverse each of the R, G and B parts of the watermark image, so that pixels like
Wfiltered(i) = 11111111
R1R2R3R40000
G1G2G3G40000
B1B2B3B40000
become
Wreversed(i) = 11111111
0000R4R3R2R1
0000G4G3G2G1
0000B4B3B2B1
(5)
That is, the leftmost bit in the Wfiltered becomes the rightmost bit in Wreversed, and similarly for the other bits in R, G and B.
Merge both images using an OR operation.
rrrr0000 gggg0000 bbbb0000 host image
ORed with 0000RRRR 0000GGGG 0000BBBB reversed watermark image
--------------------------
results in rrrrRRRR ggggGGGG bbbbBBBB watermarked image.
(6)
The pixels are now merged as Hwatermarked, in figure 2 (left) of Knox's paper. In all cases, the alpha channel remains set to all 1's.
Knox shows two images which were merged in this way (Figure 1 in his paper1 and states that the result of doing the above operation for each pixel is 'unsatisfactory'. This is because truncation was used in item (B) above.
To improve on truncation, you must implement rounding and do the FS error diffusion algorithm as explained in the lectures and tutorials. This can be done in two ways.
You are advised to do the steps in Part A in the following order:
You are advised to do the steps in Part B in the following order:
Successful performance of the above parts may result in the marks shown for the demo parts of this assignment. The final result depends on how well the actions were performed.
| Parts completed | Rough Mark |
|---|---|
| Demo Part A | |
| 1 | Pass |
| 1+2 | Credit |
| 1+2+3 | Distinction |
| 1+2+3+4 | High Distinction |
| Demo Part B | |
| 5 | Pass |
| 5+6 | Credit |
| 5+6+7 | Distinction |
| 5+6+7+8 | High Distinction |
Assignments can only be done individually. All assignments are to be written exclusively in Standard Java. Use of Visual IDE programs is allowed but only standard libraries are to be used (in particular do NOT use the MFC). The code must compile and run under the JDK1.4 system. HTML can be used for support purposes only.
Electronic copy detection software will be used to check all assignment source code. This checks program structure and generally ignores class and method names. Checks will be made with both other students and major applet sources such as gamelan, sun etc plus against previously submitted assignments. You have been warned. Use of copied source code without proper reference will result in an overall assignment mark of zero, no matter how large or small the copying is. There is no need to reference any classes from the JDK distribution.
Assignment or other work that is essentially identical to the work of another is deemed a copy. In particular, for programming, copies are works that contain Core sections of functionally identical (or near identical) code. All copies are awarded the same mark, zero. This mark is given to both the user and the supplier of the code. All assignments will be checked electronically for copies.
It is acceptable to use code pieces from the lecture notes, textbooks and the web provided that these are referenced in the following three places:
At the actual code, the reference comment should appear at the very start of the shared section, and another comment indicating the end of the shared section should also be provided. If pieces of code from any source is used without reference. then the entire assignment will also be deemed as copies as the presenter is pretending that the code presented is all their own work when it is not.
The lecturer reserves the right to reduce marks for programs which use significant referenced shared sections of code.
Marking will focus on the content of the report. Some marks will be granted for use of images and basic understanding of HTML. It should be possible to execute your applet from the web pages to connect to an active server program. Your report should include some screen dumps of your program.
Marks mainly will be given for good use of O-O principles. See style guide for source code style that is expected. ALL source files MUST include your name and a copyright notice crediting yourself and any other sources.
Demonstration Part A = 15%
Demonstration Part B = 15%
Web Page Report = 10%
Source Code = 10%
Total = 50% of the semester marks
Bonus marks (a maximum of 5%) can be awarded in a single section for exceptional work. These will not normally be granted and are included for the lecturer's discretion (only) to assist students who attempt difficult optional extras and subsequently have less time to complete other tasks. In all cases the maximum assignment mark is 50.
Last updated: September 20th 2002