supervisely icon indicating copy to clipboard operation
supervisely copied to clipboard

Fixes and tests for Geometry, add support for float value coords

Open cxnt opened this issue 1 year ago • 0 comments

Add tests for the following geometries:

  • Bitmap
  • AlphaMask
  • Polygon
  • Polyline
  • Point
  • PointLocation
  • Rectangle
  • Graph

Update annotation_api methods with integer_coords flag

Add changes to support float value type coordinates:

  • Bitmap:
    • Update _draw_contour_impl to support float values. Values will be rounded for cv2.drawContours()
    • Fix typo in docstring
  • Geometry:
    • Fix typo in docstring
  • geometry.helpers.py:
    • _geometry_to_mask_base() func fix AlphaMask to Bitmap convertion
  • Point:
    • remove round() call in constructor to preserve row, col values as is
    • update _draw_impl and _draw_contour_impl methods to use rounded values for cv2.circle() to work
  • PointLocation
    • remove round() call in constructor to preserve row, col values as is
    • Update row and col docstrings
  • Polygon
    • Update crop() method to call row_col_list_to_points() method with do_round flag set to False
    • Update approx_dp() method to call row_col_list_to_points() method with do_round flag set to False
    • Update _draw_impl method to use rounded exterior values for cv2.fillPoly()
    • Update _draw_contour_impl method to use rounded exterior values for cv2.polylines()
  • Polyline:
    • Update _draw_contour_impl method to use rounded exterior values for cv2.polylines()
  • Rectangle:
    • Update _transform() method to return Rectangle without rounding corner coordinates
    • Update _draw_contour_impl method to use rounded corner coordinates values for cv2.rectangle()
    • Update get_cropped_numpy_slice() method to crop Rectangle with rounded corner coordinates
  • VectorGeometry:
    • Update docstring annotations
    • Update exterior_np and interior properties to return np.array with float values
    • Update to_bbox() method to return Rectangle without rounded corner coordinates
    • Add _round_exterior_interior_coords() and _round_exterior_interior_coords_np() methods

cxnt avatar Jun 27 '24 16:06 cxnt