Accessing Mat pixels in 1-channel and 3-channel images