tags:

views:

85

answers:

1

i need help with the coding of a program that will read a ppm file using command line arguments ( name of the ppm, name of output ppm) what it has to do is, open the file read and store the dimensions of the image and the pixel data. There are 3 channels in a given pixel with max values of 255. must be compatible with binary bytes of data using get or read methods.

then sort the pixels by luminence based on ( red*.3+green*.59+blue*.11 ) and write the newly sorted RGB values into a ppm (2nd argument in program)

A: 

Is this homework?

Have a look at ImageMagick. It might already do what you need.

Graham Perks
yeah its our first project in CS400, and we've never done anything with images before with previous classes. and im completely lost on how to read the ppm file via command line args and get the height, width, max value, and the rgb values. if you could help me i'd love it!
Adam Buchanan
Break the problem down. First, figure out a structure for your program. Perhaps first get some command line parsing done. You can find several libraries to help with this. Next, figure out how to read PPM files. Either find a library that will do it, or research the PPM file format to write your own. With the cmd line args and the PPM data you have enough to process the data. Write the PPM file out using the same technique you read it with.
Graham Perks
alright ive been able to write the code down to right before i extract the RGB values. i know i need a for loop to loop through the ppm, but im not quite sure what to write into the for loop. ill need to save the RGB values in a vector class i have made.
Adam Buchanan