implemented method to skip pixels near edge of kernel