              logger.trace("Dilating mask")
              mask = cv2.dilate(mask, kernel, iterations=1)  # pylint: disable=no-member
          return mask
  
      def get_erosion_kernel(self, mask):
          """ Get the erosion kernel """
          erosion_ratio = self.config["erosion"] / 100
          mask_radius = np.sqrt(np.sum(mask)) / 2
          kernel_size = max(1, int(abs(erosion_ratio * mask_radius)))
          erosion_kernel = cv2.getStructuringElement(  # pylint: disable=no-member
              cv2.MORPH_ELLIPSE,  # pylint: disable=no-member
 
</s> remove         erosion_kernel = cv2.getStructuringElement(  # pylint: disable=no-member
            cv2.MORPH_ELLIPSE,  # pylint: disable=no-member
            (kernel_size, kernel_size))
 </s> add         erosion_kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (kernel_size, kernel_size)) </s> remove             mask = cv2.dilate(mask, kernel, iterations=1)  # pylint: disable=no-member
 </s> add             mask = cv2.dilate(mask, kernel, iterations=1) </s> remove             mask = cv2.erode(mask, kernel, iterations=1)  # pylint: disable=no-member
 </s> add             mask = cv2.erode(mask, kernel, iterations=1) </s> remove     def erode(self, mask):
        """ Erode/dilate mask if requested """
        kernel = self.get_erosion_kernel(mask)
 </s> add     def _erode(self, mask):
        """ Erode or dilate mask the mask based on configuration options.

        Parameters
        ----------
        mask: :class:`numpy.ndarray`
            The mask to be eroded or dilated

        Returns
        -------
        :class:`numpy.ndarray`
            The mask with erosion/dilation applied
        """
        kernel = self._get_erosion_kernel(mask) </s> remove 
    def blend(self, mask):
        """ Blur mask if requested """
        logger.trace("Blending mask")
        mask = BlurMask(self.config["type"],
                        mask,
                        self.config["radius"],
                        self.config["passes"]).blurred
        return mask
 </s> add 
    def _get_erosion_kernel(self, mask):
        """ Get the erosion kernel.

        Parameters
        ----------
        mask: :class:`numpy.ndarray`
            The mask to be eroded or dilated

        Returns
        -------
        :class:`numpy.ndarray`
            The erosion kernel to be used for erosion/dilation
        """
              logger.trace("Dilating mask")
              mask = cv2.dilate(mask, kernel, iterations=1)  # pylint: disable=no-member
          return mask
  
    def _get_erosion_kernel(self, mask):
        """ Get the erosion kernel.

        Parameters
        ----------
        mask: :class:`numpy.ndarray`
            The mask to be eroded or dilated

        Returns
        -------
        :class:`numpy.ndarray`
            The erosion kernel to be used for erosion/dilation
        """
    def _get_erosion_kernel(self, mask):
        """ Get the erosion kernel.

        Parameters
        ----------
        mask: :class:`numpy.ndarray`
            The mask to be eroded or dilated

        Returns
        -------
        :class:`numpy.ndarray`
            The erosion kernel to be used for erosion/dilation
        """
          erosion_ratio = self.config["erosion"] / 100
          mask_radius = np.sqrt(np.sum(mask)) / 2
          kernel_size = max(1, int(abs(erosion_ratio * mask_radius)))
          erosion_kernel = cv2.getStructuringElement(  # pylint: disable=no-member
              cv2.MORPH_ELLIPSE,  # pylint: disable=no-member
keep keep keep keep replace replace keep keep keep keep keep
 Smart Masks to Convert (#957)

- scripts.convert - Use Smart Masks for Convert
    * Make on-the-fly conversion an explicit option

- Move BlurMask to lib.faces_detect

- tools.preview - Fix for smart masks
    * Subclass from tk.Tk
    * Options to lib.gui.control_helper
    *variable cleanup

- lib.logger - Demote more tensorflow deprecation messages

- Documentation:
    * lib.faces_detect.BlurMask
    * plugins.convert.mask
    * lib.convert
    * scripts.convert
    * scripts.fsmedia
    * tools.preview 
plugins/convert/mask/mask_blend.py