Skip to main content

PixPick

Interactive coordinate picker for Computer Vision — no external tools needed.

PyPI version Downloads Python 3.9+ License: MIT Documentation

Project Overview

The problem

Every major CV framework needs coordinates before it can run.

# YOLO 
regioncounter = RegionCounter(region=[120, 80, 640, 480])    # where does this region come from?

# SAM2/SAM3
predictor.predict(box=np.array([120, 80, 640, 480]))         # same problem

The standard workflow: open CVAT or Roboflow → grab coordinates → paste them back into code. Every. Single. Time.

The fix

import pixpick

region = pixpick.box("video.mp4", frame=10)  # drag a box on a specific video frame
zone   = pixpick.polygon("image.jpg")        # click polygon vertices

# coordinates are ready — unpack directly into any framework
# YOLO:
regioncounter = RegionCounter(
     region=zone.yolo_region,  # pass region points
     model="yolo26n.pt",
 )

# same for YOLOE
model.predict("image.jpg", visual_prompt= region.yolo_prompt)

# SAM/SAM2/SAM3:
predictor.predict(box=region.sam)

A window opens on your image, video, or a specific video frame. You interact. You get framework-ready coordinates back in Python. No round-trips.

pixpick.box() and pixpick.polygon() both accept a frame= argument when the source is a video file.


Install

pip install pixpick

Selectors

Selector How to use Returns
pixpick.box() Left-click + drag Box
pixpick.polygon() Click vertices Polygon
pixpick.line() Click start → click end Line

Box controlsdrag to draw · R to reset · Enter to confirm · Esc to cancel

Polygon controlsLMB add point · RMB undo · Z clear · Enter confirm · Esc cancel

Line controlsLMB start → LMB end · RMB undo · Z clear · Enter confirm · Esc cancel


Output formats

Every selection object carries all the formats you'll ever need.

# ── Box ──────────────────────────────────────────────────────
region = pixpick.box("frame.jpg")

region.xyxy              # [x1, y1, x2, y2]            absolute pixels
region.xywh              # [x, y, w, h]                absolute pixels
region.norm_xywh         # [x, y, w, h]                0.0 – 1.0  ← YOLO label format
region.center            # (cx, cy)
region.area              # pixels²


# ── Polygon ───────────────────────────────────────────────────
zone = pixpick.polygon("frame.jpg")

zone.points              # [(x0,y0), (x1,y1), ...]     absolute pixels
zone.as_numpy            # np.array shape (N, 2)
zone.norm                # [(x0n,y0n), ...]             0.0 – 1.0
zone.bbox                # → Box   tight bbox around the polygon
zone.npoints             # int


## ── Line ─────────────────────────────────────────────────────
line = pixpick.line("frame.jpg")

line.points              # [(x0,y0), (x1,y1)]           absolute pixels
line.as_numpy            # np.array shape (2, 2)
line.norm                # [(x0n,y0n), (x1n,y1n)]       0.0 – 1.0
line.center              # (cx, cy)
line.length              # pixels

For more details, see Selectors.


Framework integration

Framework Selector Method
Ultralytics YOLOE — visual prompt Box region.yolo_prompt
Ultralytics YOLO — region Box/Polygon region.yolo_region
SAM / SAM2 / SAM3 — box prompt Box region.sam
Supervision PolygonZone — polygon Polygon region.supervision
Any other format Box / Polygon region.raw

Persistence

Pick once, reuse forever.

region.save("zone.json")
region = pixpick.load("zone.json")   # Box and Polygon both work

Production pattern — pick interactively the first time, load on every subsequent run:

from pathlib import Path
import pixpick

ZONE = "config/count_zone.json"

zone = pixpick.load(ZONE) if Path(ZONE).exists() else pixpick.polygon("frame.jpg")
zone.save(ZONE)

Docs

🚀 Getting Started Installation, first selection, controls
🎯 Selectors All properties and methods for Box and Polygon
🔌 Framework Integration YOLO, SAM2/SAM3 and more
💾 Persistence Save, load, JSON schema
🏗️ Architecture How it's built and how to extend it
🗺️ Roadmap What's coming next

Contributing

We welcome contributions! Please open a GitHub issue or submit a pull request. For more information, see Contribution Guidelines.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pixpick-0.2.1.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pixpick-0.2.1-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file pixpick-0.2.1.tar.gz.

File metadata

  • Download URL: pixpick-0.2.1.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for pixpick-0.2.1.tar.gz
Algorithm Hash digest
SHA256 b58123c348f0a97349bea4109bb0c9d04968a697cb97cce18cdc3ab7c66f8573
MD5 07eb3a7b33feccf659da49c510293b81
BLAKE2b-256 eccc6f30a914ad749faf1adc631e61fab5141c9d516511b83e81d996f43029d0

See more details on using hashes here.

File details

Details for the file pixpick-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: pixpick-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for pixpick-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f4ee247cde92b7f67a57cd88084ceb5b75169284e288dc0bd58389856c098d14
MD5 6c1f2e740cabc4e99f72ba492c722408
BLAKE2b-256 6b603aff72c052ae929f02f9197976c96a84f4b08b73bfd2d6c1d088ba7423e6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page