EE499 Image Processing Project 1 xx_pbmwrite

advertisement

EE499 Image Processing

Project 1

Write Octave routines xx_pbmwrite , xx_pgmwrite , and xx_ppmwrite that take two arguments – an image as the first argument and a filename as the second argument. The routines write the image to the file in the appropriate netpbm binary file format. The routines should test for the correct number of input arguments (nargin) and for the appropriate type (class or isa), dimension (ndims) and size (if appropriate).

There are test scripts and images for each of your routines (the images are used by the test scripts): xx_pbmwrite : pbmwrite_test.m

, clown_bkwh_int_uint1.png

xx_pgmwrite : pgmwrite_test.m

, clown_gray_int_uint8.png

xx_ppmwrite : ppmwrite_test.m

, clown_colr_rgb_uint8.png

The test scripts read in the test image and display it. They then write the image to disk using your routine, read the image back in from the new file and display it for comparison to the original image.

They also create a random-sized image, display it, write it to disk using your routine, read it back in and then display the new image for comparison to the original.

Recommendation: Don't use the test scripts to test your routine during development. Create a small (2 x 3 or so) image and use that. (You could create a small image by hand or read in one of the small netpbm text files we used in class.) Open your output file with a hex editor to see if it is correct.

Grading:

+75% if your xx_pgmwrite routine passes the pgmwrite_test test script.

+15% if your xx_ppmwrite routine passes the ppmwrite_test test script.

+10% if your xx_pbmwrite routine passes the pbmwrite_test test script.

Try to avoid loops if possible (it is!!). You especially want to avoid looping over the pixels in an image.

Note: The xx_pbmwrite routine will require allocating a new area of memory and twiddling bits to correspond to Octave's black and white image type.

Email your three routines as attachments to richardson.tony@gmail.com

with the subject "EE499 –

Project 1 – Your Name ".

Download