              frame = background
          np.clip(frame, 0.0, 1.0, out=frame)
          return frame
  
      def scale_image(self, frame):
          """ Scale the image if requested """
          if self.scale == 1:
              return frame
          logger.trace("source frame: %s", frame.shape)
          interp = cv2.INTER_CUBIC if self.scale > 1 else cv2.INTER_AREA  # pylint: disable=no-member
          dims = (round((frame.shape[1] / 2 * self.scale) * 2),
                  round((frame.shape[0] / 2 * self.scale) * 2))
 
</s> remove         interp = cv2.INTER_CUBIC if self.scale > 1 else cv2.INTER_AREA  # pylint: disable=no-member
        dims = (round((frame.shape[1] / 2 * self.scale) * 2),
                round((frame.shape[0] / 2 * self.scale) * 2))
        frame = cv2.resize(frame, dims, interpolation=interp)  # pylint: disable=no-member
 </s> add         interp = cv2.INTER_CUBIC if self._scale > 1 else cv2.INTER_AREA
        dims = (round((frame.shape[1] / 2 * self._scale) * 2),
                round((frame.shape[0] / 2 * self._scale) * 2))
        frame = cv2.resize(frame, dims, interpolation=interp) </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     def get_erosion_kernel(self, mask):
        """ Get the erosion kernel """
 </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
        """ </s> remove         if blur_kernel == 0 or blur_kernel % 2 == 1:
            self._blur_kernel = blur_kernel
        else:
            self._blur_kernel = blur_kernel + 1
 </s> add         if blur_type is not None:
            blur_kernel += 0 if blur_kernel == 0 or blur_kernel % 2 == 1 else 1
            self._blur["kernel"] = blur_kernel
            self._blur["type"] = blur_type
            self._blur["passes"] = blur_passes </s> remove     def load(self, *args):  # pylint: disable=unused-argument
        """ Load the images with detected_faces"""
 </s> add     def _load(self, *args):  # pylint: disable=unused-argument
        """ Load frames from disk.

        In a background thread:
            * Loads frames from disk.
            * Discards or passes through cli selected skipped frames
            * Pairs the frame with its :class:`~lib.faces_detect.DetectedFace` objects
            * Performs any pre-processing actions
            * Puts the frame and detected faces to the load queue
        """
    def _scale_image(self, frame):
        """ Scale the final image if requested.

        If output scale has been requested in command line arguments, scale the output
        otherwise return the final frame.

        Parameters
        ----------
        frame: :class:`numpy.ndarray`
            The final frame with faces swapped

        Returns
        -------
        :class:`numpy.ndarray`
            The final frame scaled by the requested scaling factor
        """
        if self._scale == 1:
              frame = background
          np.clip(frame, 0.0, 1.0, out=frame)
          return frame
  
    def _scale_image(self, frame):
        """ Scale the final image if requested.

        If output scale has been requested in command line arguments, scale the output
        otherwise return the final frame.

        Parameters
        ----------
        frame: :class:`numpy.ndarray`
            The final frame with faces swapped

        Returns
        -------
        :class:`numpy.ndarray`
            The final frame scaled by the requested scaling factor
        """
        if self._scale == 1:
    def _scale_image(self, frame):
        """ Scale the final image if requested.

        If output scale has been requested in command line arguments, scale the output
        otherwise return the final frame.

        Parameters
        ----------
        frame: :class:`numpy.ndarray`
            The final frame with faces swapped

        Returns
        -------
        :class:`numpy.ndarray`
            The final frame scaled by the requested scaling factor
        """
        if self._scale == 1:
    def _scale_image(self, frame):
        """ Scale the final image if requested.

        If output scale has been requested in command line arguments, scale the output
        otherwise return the final frame.

        Parameters
        ----------
        frame: :class:`numpy.ndarray`
            The final frame with faces swapped

        Returns
        -------
        :class:`numpy.ndarray`
            The final frame scaled by the requested scaling factor
        """
        if self._scale == 1:
              return frame
          logger.trace("source frame: %s", frame.shape)
          interp = cv2.INTER_CUBIC if self.scale > 1 else cv2.INTER_AREA  # pylint: disable=no-member
          dims = (round((frame.shape[1] / 2 * self.scale) * 2),
                  round((frame.shape[0] / 2 * self.scale) * 2))
keep keep keep keep replace 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 
lib/convert.py