In this project, you're going to modify CHDK to do focus stacking. The full source code for CHDK is here, and that's what you need to be playing with.
Focus stacking works by capturing multiple images at different focus distances and then, for each pixel, taking the pixel value from the sharpest image. That's it.
The key trick is to shoot raw. The raw merge facility basically reads-in a row of pixels at a time, so you'll simply be detecting maximum contrast within a row.... Note that you can do that by simply measuring contrast between the current pixel and the pixels at X coordinates +/-2 from here -- those are the nearest pixels in the same color channel.
You will be submitting source code for the portion of CHDK that you modified (or the whole thing), the CHDK Lua script that you used to trigger the operation, a make file (which does whatever is necessary), and a simple "implementor's notes" document. For this project, you definitely have design decisions to talk about in those notes -- primarily what file(s) you modified within CHDK.
For full consideration, your project should be submitted no later than the Final exam timeslot. Submit your .tar or .tgz file here: