I am trying to work on an assignment that will load a PGM file, put the corresponding gray level values in a 2D integer array, and be able to manipulate the gray levels according to method (mean and median) and the selected window size, which will then alter the image as either "smoothed" or "oil painted".
Anyways, I'm trying to figure out the best way to grab the data from the PGM file to put into the 2D array. When you open the PGM in a text editor, the rows and columns in the PGM file do not match up to the specified rows and columns in the header and are messy. Therefore, I obviously cannot read each line through BufferedReader and grab each gray level value through substring in a nested for loop to add to the 2D array. To add to that, each value can be 1, 2, or 3 digits long.
My professor has not really covered this at all yet, and its pretty much the start of the program. It's due in a week and I figured I should really get a start on it now. If anybody can point me in the right direction, I'd greatly appreciate it. Thanks.