this is the main failure. your image did not load.
‘mm.PNG’ is not, where your program starts
imread() returns None
in that case.
you should add a check like :
if (np.shape(img)==()): #read error, you cant go on !
after each imread(), to be safe !
will return an empty []
then (again, see example above !),
and you cannot unpack that to a rgb tuple
(which would be bgr order in opencv anyway)