MP4 README - ECE190 - Fall 09 For James Scholars ------------------ James Scholars email me at manamch1@illinois.edu as your MP would have to be graded separately. However, your handin will work as the same as for the other students. Unzipping the Sample files: -------------------------- Use the command 'unzip images1.zip' to unzip and extract the sample PPM images Filter Size limit: ----------------- The filter can at most be 9x9. So you can limit your filter array to size 9x9 Using the image: --------------- You should rename the sample images to 'image.ppm' and access it in your program as image.ppm To rename a file use the command, 'cp shark.ppm image.ppm' or 'cp square-oval.ppm image.ppm' The above commands keep your original file intact while creating a copy of the file named image.ppm. You should use this command for the specific image file you are going to be working on. The output file should be named 'output.ppm' General Notes: ------------- 1. All your files and your program should be in the same folder. 2. Your first checkpoint file should be named mp4.1.c 3. For checkpoint 1, the file when executed should read in image.ppm and filter.txt and create an output image output.ppm Frequently Asked Questions: -------------------------- **Updated 11/6** 1. In the handout, it mentions that each pixels RGB components are on the same line, but in the file it seems to be on different lines. How do I handle it ? The actual image.ppm can have the values either having the RGB components on the same line or on different lines. Your file i/o will handle both the cases in the same way. For example, consider an image file as shown below (according to the handout) P3 3 2 255 255 0 0 0 255 0 0 0 255 255 255 0 255 255 255 0 0 0 This file is the same as : P3 3 2 255 255 0 0 0 255 0 0 0 255 255 255 0 255 255 255 0 0 0 When using fscanf("%d",FILE), this function takes new line OR a space as a delimiter. So you can iteratively call fscanf and it will return the values one by one, no matter how they are represented in the file. 2. Is the output image of the shark supposed to be really washed out/bright? The output image should NOT be washed out or bright. Since you will multiply the value of the pixels with the filter value and then DIVIDE the value by the sum of the filter values, the value of the pixel will not increase much. It will just be affected by the values of the adjacent pixels. Also, the value in the pixels CANNOT exceed 255 (because of the mathematics) **Updated 11/7** 3. Is the size of the filter always an odd number ? Yes. The size of the filter is ALWAYS an odd number. 4. How do I handle the edge pixels ? When handling edge pixels, you multiply the values of the filter which are coinciding with a pixel and ignore the rest of the filter values. You have to add all the multiplied values (as you do normally) and then divide it by the filter values which were NOT ignored. (**Updated 11/9) 5. How do I use the find_diff ? In the ECE190 course website, right-click and 'Save As' the find_diff.out.zip file. Save the file to the ece190 work folder. Unzip the file and get the executable find_diff.out Run this command once. chmod 777 find_diff.out After running this you can now execute the find_diff code. The syntax for using the command is ./find_diff.out out.ppm shark-blurred.ppm When you run this command, the program will calculate the pixel error in your Red, Green and Blue values. Try to get this error to zero. (**Updated 11/10) 6. What kind of errors should my code check for ? -- Always assume that the given file will be P3 format. -- Your output file should not have any pixel value to be more than the maximum value specified in the input file. -- Assume that there will be no negative pixel values. -- The filter values will not be negative for checkpoint 1 7. The find_diff program returns a single channel error value ? What should I do ? -- Try to get the error to zero for full credits. Partial credits will be given for minimal error values. (**Updated 11/14) 8. Will the squares be tilted ? No the squares will not be tilted at an angle. They will be oriented straight 9. Will the squares touch the edges of the image ? No the squares will not touch the edge of the image. There will atleast be a 2 pixel gap between the square and the edge 10. What should my output look like ? After calculating the area, save the answer in a variable called 'area'. Save the center of the square in variables called 'centerx' and 'centery' Use the following code to print the answer printf("Square Found!\n"); printf("The Area of the square is %d.\n", area); printf("The center of the square is at (%d, %d).", centerx, centery); If no squares are found then printf("No square found in given image.\n"); (** Updated 11/16) There is mp4.2.gold gold code available for testing the TA solution. You can run this from the ece190 environment by typing "mp4.2.gold" at the command line with the input file as arguments. Please check that you have the most recent sample images for test. The SqSet2.ppm image had some issues and was removed. You will not be graded on that particular image.