Skip to main content

pixpick ๐ŸŽฏ

Interactive coordinate picker for Computer Vision โ€” no external tools needed.

PyPI version Downloads Python 3.8+ License: MIT

Project Overview


The problem

Every major CV framework needs coordinates before it can run.

regioncounter = RegionCounter(region=[120, 80, 640, 480])    # YOLO   โ€” where does this region come from?
predictor.predict(box=np.array([120, 80, 640, 480]))         # SAM2   โ€” 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())

# SAM1/SAM2:
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 โ†’ Enter to confirm Polygon

Box controls โ€” drag to draw ยท R to reset ยท Esc to cancel

Polygon controls โ€” LMB add point ยท 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

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 โ€” box prompt Box region.sam()
Any other format Box / Polygon region.to_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 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 CONTRIBUTING.md.

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.1.4.tar.gz (18.1 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.1.4-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pixpick-0.1.4.tar.gz
Algorithm Hash digest
SHA256 454401e8e2466dc1bfb21931c00babc68333cf1f5ec34ad71252c09750009f7c
MD5 562e93849217eb58b07e53c103a1663d
BLAKE2b-256 400f7c1a5708878e6b6cf0f72783349fe7352d3ba5fedee991dbc06e6158c3f9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pixpick-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 16.8 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.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 659157fefe49cab1cc25ff3b58aba63552e8725a1063f63e5867fd6e4abb3e06
MD5 081f668509f5f71c55a0c554ac035c2c
BLAKE2b-256 9d161c4d6c3b02df31d75f9d0be532897e82d9f1d868102e95c82ec0431e07e2

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