Ground Segmentation with SAM
SUMMARY
Identify the drivable floor surface so mobile robots, forklifts, and AMRs can navigate safely — a task that markings, shadows, reflections, pallets, and debris make unreliable for rule-based or color-based methods. segment_image_using_sam returns a pixel-accurate ground mask that separates drivable space from everything else.
Raw Sensor Input


Raw sensor input showing a warehouse or factory floor.
Segmentation and Mask


Segmented image showing the ground mask for drivable area estimation.
Code
python
from telekinesis import cornea
# `image` is a datatypes.Image (or np.ndarray) of the floor/scene.
# `bboxes` is one [x1, y1, x2, y2] box per ground region of interest —
# typically the region a robot or AMR is about to traverse.
segmentation_results = cornea.segment_image_using_sam(
image=image,
bboxes=bboxes,
mask_threshold=0.5,
)
# Each result carries a bounding box, a mask-quality score, and an
# encoded segmentation mask for that region — treat the mask as
# drivable space and everything outside it as a potential obstacle.
for result in segmentation_results:
box = result.bbox
score = result.score
mask = result.segmentation
