Name 'cv2' is not defined

you have to either

import cv2

in the current cell,
or run another cell importing it before.