docstr: Put logo_mask onto the center of the ready-to-perturbed area.
  
  Return: mask for img, resized logo mask for ad area
docstr_tok: ["Put","logo_mask","onto","the","center","of","the","ready-to-perturbed","area",".","Return",":","mask","for","img",",","resized","logo","mask","for","ad","area"]
code: def _add_logomask(self, mask, logo_mask, xmin, ymin, xmax, ymax):
      """
      Put logo_mask onto the center of the ready-to-perturbed area.
  
      Return: mask for img, resized logo mask for ad area
      """
      ad_width = xmax - xmin
      ad_height = ymax - ymin
  
      ad_area_center_x = old_div((xmin + xmax), 2)
      ad_area_center_y = old_div((ymin + ymax), 2)
  
      ad_ratio = old_div(ad_width, ad_height)
  
      logo_height = logo_mask.shape[0]
      logo_width = logo_mask.shape[1]
      logo_ratio = old_div(logo_width, logo_height)
  
      # make sure logo is contained by ad area
      if ad_ratio > logo_ratio:
          resize_ratio = old_div(ad_width, logo_height)
      else:
          resize_ratio = old_div(ad_height, logo_width)
  
      # cv2.resize only eats integer
      resized_height = int(logo_height * resize_ratio)
      resized_width = int(logo_width * resize_ratio)
  
      resized_logo_mask = None
      # skip cases where resize area is too small
      if resized_width != 0 and resized_height != 0:
          resized_logo_mask = cv2.resize(
              logo_mask, (resized_width, resized_height)
          )
  
          paste_xmin = int(ad_area_center_x - old_div(resized_width, 2))
          paste_ymin = int(
              ad_area_center_y - old_div(resized_height, 2)
          )
          paste_xmax = paste_xmin + resized_width
          paste_ymax = paste_ymin + resized_height
  
          if (xmin + resized_height) < mask.shape[0] and (
              ymin + resized_width
          ) < mask.shape[1]:
              mask[
                  paste_ymin:paste_ymax, paste_xmin:paste_xmax
              ] = resized_logo_mask
              # np.zeros([resized_height,resized_width,3])
          else:
              pass
      else:
          pass
  
      return mask, resized_logo_mask
  
imports: from __future__ import division
  from __future__ import print_function
  from builtins import input
  from builtins import range
  from builtins import object
  from past.utils import old_div
  from abc import ABCMeta
  from abc import abstractmethod
  import numpy
  import cv2
  import os
  import xmltodict
  import pdb
  from future.utils import with_metaclass
label_desc: Use image node_id 16 for calling the ODD_logic obj's underlying member method code with example usage: obj._add_logomask(mask, logo_mask, xmin, ymin, xmax, ymax) and returns: mask,  resized_logo_mask