Skip to content

Commit

Permalink
fix: check if laser_coords is None
Browse files Browse the repository at this point in the history
  • Loading branch information
ccrutchf committed Nov 14, 2024
1 parent 143f07c commit dddc3f9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fishsense_lite/commands/label_studio.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def execute_fishial(

ml_depth_map = DepthAnythingDepthMap(img8, device)

if laser_coords:
if laser_coords is not None:
laser_coords_int = np.round(laser_coords).astype(int)
depth_map = LaserDepthMap(
laser_coords, lens_calibration, estimated_laser_calibration
Expand Down
14 changes: 13 additions & 1 deletion fishsense_lite/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,21 @@ def get_root(files: List[Path]) -> Path | None:
return root


def uint8_2_double(img: np.ndarray) -> np.ndarray:
return img.astype(np.float64) / 255


def uint16_2_double(img: np.ndarray) -> np.ndarray:
return img.astype(np.float64) / 65535


def double_2_uint8(img: np.ndarray) -> np.ndarray:
return (img * 255).astype(np.uint8)


def double_2_uint16(img: np.ndarray) -> np.ndarray:
return (img * 65535).astype(np.uint16)


def uint16_2_uint8(img: np.ndarray) -> np.ndarray:
return (uint16_2_double(img) * 255).astype(np.uint8)
return double_2_uint8(uint16_2_double(img))

0 comments on commit dddc3f9

Please sign in to comment.