docstr: Mapping 2D Gaussian to the character box coordinates of the score_map.
  
  :param score_map: Target map to put 2D gaussian on character box
  :type score_map: np.float32
  :param bbox: character boxes
  :type bbox: np.float32
  :param enlarge_size: Enlarge size of gaussian map to fit character shape
  :type enlarge_size: list of enlarge size [x dim, y dim]
  :param horizontal_text_bool: Flag that bbox is horizontal text or not
  :type horizontal_text_bool: bool
  :param map_type: Whether map's type is "region" | "affinity"
  :type map_type: str
  :return score_map: score map that all 2D gaussian put on character box
  :rtype: np.float32
docstr_tok: ["Mapping","2D","Gaussian","to","the","character","box","coordinates","of","the","score_map",".",":","param","score_map",":","Target","map","to","put","2D","gaussian","on","character","box",":","type","score_map",":","np.float32",":","param","bbox",":","character","boxes",":","type","bbox",":","np.float32",":","param","enlarge_size",":","Enlarge","size","of","gaussian","map","to","fit","character","shape",":","type","enlarge_size",":","list","of","enlarge","size","[","x","dim",",","y","dim","]",":","param","horizontal_text_bool",":","Flag","that","bbox","is","horizontal","text","or","not",":","type","horizontal_text_bool",":","bool",":","param","map_type",":","Whether","map","'s","type","is","``","region","''","|","``","affinity","''",":","type","map_type",":","str",":","return","score_map",":","score","map","that","all","2D","gaussian","put","on","character","box",":","rtype",":","np.float32"]
code: def add_gaussian_map_to_score_map(
      self,
      score_map,
      bbox,
      enlarge_size,
      horizontal_text_bool,
      map_type=None,
  ):
      """
      Mapping 2D Gaussian to the character box coordinates of the score_map.
  
      :param score_map: Target map to put 2D gaussian on character box
      :type score_map: np.float32
      :param bbox: character boxes
      :type bbox: np.float32
      :param enlarge_size: Enlarge size of gaussian map to fit character shape
      :type enlarge_size: list of enlarge size [x dim, y dim]
      :param horizontal_text_bool: Flag that bbox is horizontal text or not
      :type horizontal_text_bool: bool
      :param map_type: Whether map's type is "region" | "affinity"
      :type map_type: str
      :return score_map: score map that all 2D gaussian put on character box
      :rtype: np.float32
      """
  
      map_h, map_w = score_map.shape
      bbox = enlargebox(
          bbox, map_h, map_w, enlarge_size, horizontal_text_bool
      )
  
      # If any one point of character bbox is out of range, don't put in on map
      if (
          np.any(bbox < 0)
          or np.any(bbox[:, 0] > map_w)
          or np.any(bbox[:, 1] > map_h)
      ):
          return score_map
  
      bbox_left, bbox_top = np.array(
          [np.min(bbox[:, 0]), np.min(bbox[:, 1])]
      ).astype(np.int32)
      bbox -= (bbox_left, bbox_top)
      warped_gaussian_map, width, height = self.four_point_transform(
          bbox.astype(np.float32)
      )
  
      try:
          bbox_area_of_image = score_map[
              bbox_top : bbox_top + height,
              bbox_left : bbox_left + width,
          ]
          high_value_score = np.where(
              warped_gaussian_map > bbox_area_of_image,
              warped_gaussian_map,
              bbox_area_of_image,
          )
          score_map[
              bbox_top : bbox_top + height,
              bbox_left : bbox_left + width,
          ] = high_value_score
  
      except Exception as e:
          print("Error : {}".format(e))
          print(
              "On generating {} map, strange box came out. (width: {}, height: {})".format(
                  map_type, width, height
              )
          )
  
      return score_map
  
file_path: EasyOCR/trainer/craft/data/gaussian.py
imports: import numpy
  import cv2
  from data.boxEnlarge import enlargebox
label_desc: Use image node_id 5 for calling the GaussianBuilder obj's underlying member method code with example usage: obj.add_gaussian_map_to_score_map(score_map, bbox, enlarge_size, horizontal_text_bool, map_type) and returns: score_map, score_map