got part 1 working. silly loop variable mistake and file initialization mistake (not using im2double on the input image so that it is normalized