code: def filter_bboxes_by_visibility(
      original_shape: Sequence[int],
      bboxes: Sequence[BoxType],
      transformed_shape: Sequence[int],
      transformed_bboxes: Sequence[BoxType],
      threshold: float = 0.0,
      min_area: float = 0.0,
  ) -> List[BoxType]:
      """Filter bounding boxes and return only those boxes whose visibility after transformation is above
      the threshold and minimal area of bounding box in pixels is more then min_area.
  
      Args:
          original_shape: Original image shape `(height, width, ...)`.
          bboxes: Original bounding boxes `[(x_min, y_min, x_max, y_max)]`.
          transformed_shape: Transformed image shape `(height, width)`.
          transformed_bboxes: Transformed bounding boxes `[(x_min, y_min, x_max, y_max)]`.
          threshold: visibility threshold. Should be a value in the range [0.0, 1.0].
          min_area: Minimal area threshold.
  
      Returns:
          Filtered bounding boxes `[(x_min, y_min, x_max, y_max)]`.
  
      """
      img_height, img_width = original_shape[:2]
      transformed_img_height, transformed_img_width = transformed_shape[
          :2
      ]
  
      visible_bboxes = []
      for bbox, transformed_bbox in zip(bboxes, transformed_bboxes):
          if not all(
              0.0 <= value <= 1.0 for value in transformed_bbox[:4]
          ):
              continue
          bbox_area = calculate_bbox_area(bbox, img_height, img_width)
          transformed_bbox_area = calculate_bbox_area(
              transformed_bbox,
              transformed_img_height,
              transformed_img_width,
          )
          if transformed_bbox_area < min_area:
              continue
          visibility = transformed_bbox_area / bbox_area
          if visibility >= threshold:
              visible_bboxes.append(transformed_bbox)
      return visible_bboxes
  
imports: from __future__ import division
  from typing import Any, Dict, List, Optional, Sequence, Tuple, TypeVar, cast
  import numpy
  from .transforms_interface import BoxInternalType, BoxType
  from .utils import DataProcessor, Params
label_desc: Use image node_id 6 for calling a global function with example usage: filter_bboxes_by_visibility(original_shape, bboxes, transformed_shape, transformed_bboxes, threshold, min_area) and returns: visible_bboxes