code: def image(self, captcha_str):
          
          img = self.captcha.generate(captcha_str)
          img = np.fromstring(img.getvalue(), dtype='uint8')
          img = cv2.imdecode(img, cv2.IMREAD_GRAYSCALE)
          img = cv2.resize(img, (self.h, self.w))
          img = img.transpose(1, 0)
          img = np.multiply(img, 1 / 255.0)
          return img
docs: Generate a greyscale captcha image representing number string
  
          Parameters
          ----------
          captcha_str: str
              string a characters for captcha image
  
          Returns
          -------
          numpy.ndarray
              Generated greyscale image in np.ndarray float type with values normalized to [0, 1]