docstr: Parameters
  ----------
  img: image of type np.uint8
  
  Returns image of dtype np.uint8
  -------
docstr_tok: ["Parameters","--","--","--","--","--","img",":","image","of","type","np.uint8","Returns","image","of","dtype","np.uint8","--","--","--","-"]
code: def normalize(self, img):
      """
  
      Parameters
      ----------
      img: image of type np.uint8
  
      Returns image of dtype np.uint8
      -------
  
      """
      # resize the image to a appropriate height close to the target height to speed up dewarping
      intermediate_height = int(self.target_height * 1.5)
      m1 = 1
  
      if intermediate_height < img.shape[0]:
          m1 = intermediate_height / img.shape[0]
          img = scale_to_h(img, intermediate_height)
  
      if img.size == 0:
          cval = 1
      elif img.ndim == 2:
          cval = np.amax(img).item()
      else:
          x, y = np.unravel_index(
              np.argmax(np.mean(img, axis=2)), img.shape[:2]
          )
          cval = img[x, y, :].tolist()
  
      dewarped = self.dewarp(img, cval=cval)
  
      t = dewarped.shape[0] - img.shape[0]
      # scale to target height
      scaled = scale_to_h(dewarped, self.target_height)
  
      if dewarped.size == 0:
          # Empty image
          m2 = 1
      else:
          m2 = scaled.shape[1] / dewarped.shape[1]
      return scaled, (m1, m2, t)
  
file_path: calamari/calamari_ocr/ocr/dataset/imageprocessors/center_normalizer.py
imports: from dataclasses import dataclass, field
  from typing import Type, Tuple
  import numpy
  import cv2
  from paiargparse import pai_dataclass
  from tfaip.data.pipeline.processor.dataprocessor import DataProcessorParams
  from calamari_ocr.ocr.dataset.imageprocessors.scale_to_height_processor import scale_to_h
  from calamari_ocr.ocr.dataset.imageprocessors.data_preprocessor import ImageProcessor
label_desc: Use image node_id 6 for calling the CenterNormalizerProcessor obj's underlying member method code with example usage: obj.normalize(img) and returns: scaled,  m1,  m2,  t