fixed: cannot handle grayscale (1-channel) input images