code: def resize_norm_img_srn(self, img, image_shape):
      imgC, imgH, imgW = image_shape
  
      img_black = np.zeros((imgH, imgW))
      im_hei = img.shape[0]
      im_wid = img.shape[1]
  
      if im_wid <= im_hei * 1:
          img_new = cv2.resize(img, (imgH * 1, imgH))
      elif im_wid <= im_hei * 2:
          img_new = cv2.resize(img, (imgH * 2, imgH))
      elif im_wid <= im_hei * 3:
          img_new = cv2.resize(img, (imgH * 3, imgH))
      else:
          img_new = cv2.resize(img, (imgW, imgH))
  
      img_np = np.asarray(img_new)
      img_np = cv2.cvtColor(img_np, cv2.COLOR_BGR2GRAY)
      img_black[:, 0 : img_np.shape[1]] = img_np
      img_black = img_black[:, :, np.newaxis]
  
      row, col, c = img_black.shape
      c = 1
  
      return np.reshape(img_black, (c, row, col)).astype(np.float32)
  
imports: import os
  import sys
  from PIL import Image
  import cv2
  import numpy
  import math
  import time
  import traceback
  import paddle
  import tools.infer.utility
  from ppocr.postprocess import build_post_process
  from ppocr.utils.logging import get_logger
  from ppocr.utils.utility import get_image_file_list, check_and_read
label_desc: Use image node_id 4 for calling the TextRecognizer obj's underlying member method code with example usage: obj.resize_norm_img_srn(img, image_shape) and returns: np