rectifyBBox (bbox) {
    // horizontal top
    if (bbox[0].y != bbox[1].y) {
      let ymin = Math.min(bbox[0].y, bbox[1].y)
      bbox[0].y = ymin
      bbox[1].y = ymin
    }

    // horizontal bottom
    if (bbox[3].y != bbox[2].y) {
      let ymax = Math.max(bbox[3].y, bbox[2].y)
      bbox[3].y = ymax
      bbox[2].y = ymax
    }

    // vertical right
    if (bbox[1].x != bbox[2].x) {
      let xmax = Math.max(bbox[1].x, bbox[2].x)
      bbox[1].x = xmax
      bbox[2].x = xmax
    }

    // vertical left
    if (bbox[0].x != bbox[3].x) {
      let xmin = Math.min(bbox[0].x, bbox[3].x)
      bbox[0].x = xmin
      bbox[3].x = xmin
    }

    return bbox
  }
/**
   *
   * computer vision is not very precise.
   * so we need to be sure that bounding box lines are paralell to axis
   * to get a better comparison ratio
   *
   * this process results in a slightly bigger bounding box with aligned vertices
   *
   */
computer vision is not very precise.
so we need to be sure that bounding box lines are paralell to axis
to get a better comparison ratio

this process results in a slightly bigger bounding box with aligned vertices
computer vision is not very precise . so we need to be sure that bounding box lines are paralell to axis to get a better comparison ratio this process results in a slightly bigger bounding box with aligned vertices
rectifyBBox (bbox) {
    if (bbox[0].y != bbox[1].y) {
      let ymin = Math.min(bbox[0].y, bbox[1].y)
      bbox[0].y = ymin
      bbox[1].y = ymin
    }
    if (bbox[3].y != bbox[2].y) {
      let ymax = Math.max(bbox[3].y, bbox[2].y)
      bbox[3].y = ymax
      bbox[2].y = ymax
    }
    if (bbox[1].x != bbox[2].x) {
      let xmax = Math.max(bbox[1].x, bbox[2].x)
      bbox[1].x = xmax
      bbox[2].x = xmax
    }
    if (bbox[0].x != bbox[3].x) {
      let xmin = Math.min(bbox[0].x, bbox[3].x)
      bbox[0].x = xmin
      bbox[3].x = xmin
    }
    return bbox
  }
rectifyBBox ( bbox ) { if ( bbox [ 0 ] . y != bbox [ 1 ] . y ) { let ymin = Math . min ( bbox [ 0 ] . y , bbox [ 1 ] . y ) bbox [ 0 ] . y = ymin bbox [ 1 ] . y = ymin } if ( bbox [ 3 ] . y != bbox [ 2 ] . y ) { let ymax = Math . max ( bbox [ 3 ] . y , bbox [ 2 ] . y ) bbox [ 3 ] . y = ymax bbox [ 2 ] . y = ymax } if ( bbox [ 1 ] . x != bbox [ 2 ] . x ) { let xmax = Math . max ( bbox [ 1 ] . x , bbox [ 2 ] . x ) bbox [ 1 ] . x = xmax bbox [ 2 ] . x = xmax } if ( bbox [ 0 ] . x != bbox [ 3 ] . x ) { let xmin = Math . min ( bbox [ 0 ] . x , bbox [ 3 ] . x ) bbox [ 0 ] . x = xmin bbox [ 3 ] . x = xmin } return bbox }
computer vision is not very precise.
computer vision is not very precise .
// horizontal top // horizontal bottom // vertical right // vertical left