CSC320 Visual Computing
Assignment 3

Due: Monday March 15 at 9AM.
Late penalty: 15% /day to a maximum of 4 days, not accepted after that.
Hand in: Submit submit electronically here
Marking: See the syllabus
Groups: Groups of 2
Environment:Java 1.4, under linux in 1158

Announcements

Requirements

Documentation

Please document your code, describing any interesting algorithms. Describe any interesting features you have added.

My development notes

Use these at your own risk. These are notes I am making while working on the solution. The structure of the program will necessarily change as I learn about the problem. This is the reality of software development.

Student samples

References

Questions and Answers

Question:
Can I have some more images of tiles?
Answer:
OK, here are some...
Question:
How should I approach this problem?
Answer:
I will be maintaining a set of development notes. You are welcome to follow along or not as you wish.
Question:
  1. arbitrary number of channels I read the "Development Notes" but don't quite understand the structure of the design.
  2. bit shift operators: can you please explain how it works and where and when do we need them?
  3. why does Haar transform need to be recursive? please expalin.
Answer:
  1. Well you will need at least 3 channels, one corresponding to each of red, green, blue. You will be performing the Harr transform on each channel.
  2. Bit shift operators can be found here See the sample code at the top of the PixelGrabber documentation in the Java API (careful, I am sure I saw one version of this sample code that was incorrect).
  3. Well it does not have to be recursive, a simple, obviously correct implementation is recursive. There is another approach which yields a simple transform. See the development notes.
Question:
Can you give us a example of how to use bitwise in oder to calculate the pixel. Thank you.
Answer:
OK, here is a snipet from my code. In it, I separate out the three channels. int pixel=bimg.getRGB(x,y); c[2][x][y]=(short)(pixel & 0xff); // blue pixel=pixel >> 8; c[1][x][y]=(short)(pixel & 0xff); // green pixel=pixel >> 8; c[0][x][y]=(short)(pixel & 0xff); // red
Question:
Why can't I load files from other directories using the supplied code?
Answer:
There is an error in the handler for the File/Open Image menu item. I have included the fix below. The issue is that I previously only extracted the file name from the instance of File returned by the fileChooser. I need to extract the full pathname for the file. menuItem = new JMenuItem("Open Image"); menuItem.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ int returnValue=fileChooser.showOpenDialog(AppFrame.this); if (returnValue == JFileChooser.APPROVE_OPTION) { String fileName=fileChooser.getSelectedFile().getAbsolutePath(); if(imagePanel.setImage(fileName))pack(); } } }); menu.add(menuItem);
Question:
It takes a long time to tile my image!!
Answer:
If you are creating lots of instances of any class (PixelGrabber comes to mind) then Your system may be swapping or you may be garbage collecting a lot. Maybe don't do that (ie create many instances of the PixelGrabber). I did not actually use PixelGrabber in my code so far.
Question:
For Haar tiling, the users can specify tiles only in the range 4x4-16x16 right?
Answer:
When I said User chooses a range of tile sizes (ie 4x4 to 16x16). I was giving an example of what the user actually chose. You should provide a range of choices (min size and max size). You can make this picture dependent.