fixed some image access crashing bugs

cv2 does [r,c] access/shape, and was inconsistent on iteration bounds
for c,r