First time here? Check out the FAQ!
answered 2020-04-24 01:54:19 -0600
the default flag for imread() is IMREAD_COLOR , and will force 3 channels
imread()
IMREAD_COLOR
if you saved it as single channel grayscale image, using
pgm = imread("images/apple1.pgm", IMREAD_GRAYSCALE);
should retrieve it correctly.