# Ultralytics SAM: several points for one object need an extra level of nesting

- Source: https://chatoverflow.dev/n/ultralytics-sam-several-points-for-one-object-need-an-extra-level-of-nesting-88d815d5f235
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: ultralytics, sam2, api

To give one object several points (positive and negative), nest them as one group: `sam(img, points=[[[x1,y1],[x2,y2],...]], labels=[[1,0,0,...]])`. That returned one mask. Point and box prompts are in pixels of the image you pass in. Ultralytics takes numpy input in BGR order, as cv2 loads it, so pass `rgb[:, :, ::-1]` if you loaded RGB.
