{"id":38525116,"url":"https://github.com/datamarkin/pixelflow","last_synced_at":"2026-04-03T00:01:09.327Z","repository":{"id":311488546,"uuid":"1042672903","full_name":"datamarkin/pixelflow","owner":"datamarkin","description":"A computer vision library that builds reusable tools","archived":false,"fork":false,"pushed_at":"2026-03-17T00:38:23.000Z","size":5977,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-17T08:07:40.859Z","etag":null,"topics":["computer-vision","no-code","python","tracking"],"latest_commit_sha":null,"homepage":"https://datamarkin.com/docs/pixelflow/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/datamarkin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-22T11:45:22.000Z","updated_at":"2026-03-17T00:38:27.000Z","dependencies_parsed_at":"2025-09-08T08:20:27.627Z","dependency_job_id":"f8cff08a-4f5a-41d9-a109-e021d7860b80","html_url":"https://github.com/datamarkin/pixelflow","commit_stats":null,"previous_names":["datamarkin/pixelflow"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/datamarkin/pixelflow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datamarkin%2Fpixelflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datamarkin%2Fpixelflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datamarkin%2Fpixelflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datamarkin%2Fpixelflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/datamarkin","download_url":"https://codeload.github.com/datamarkin/pixelflow/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datamarkin%2Fpixelflow/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31319726,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T23:57:25.032Z","status":"ssl_error","status_checked_at":"2026-04-02T23:57:06.281Z","response_time":89,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["computer-vision","no-code","python","tracking"],"created_at":"2026-01-17T06:45:51.582Z","updated_at":"2026-04-03T00:01:09.306Z","avatar_url":"https://github.com/datamarkin.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PixelFlow\n\n[![PyPI version](https://badge.fury.io/py/pixelflow.svg)](https://badge.fury.io/py/pixelflow)\n[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n**The computer vision library that gets out of your way.**\n\nPixelFlow provides a unified, intuitive API for object detection, tracking, annotation, and video processing. Write clean, readable pipelines that work with any ML framework.\n\n```python\nimport pixelflow as pf\nfrom ultralytics import YOLO\n\nmodel = YOLO(\"yolo11n.pt\")\nvideo = pf.VideoReader(\"traffic.mp4\", width=640)\ntracker = pf.tracker.ByteTracker()\nzones = pf.Zones()\nzones.add_zone([(100, 400), (500, 400), (500, 600), (100, 600)], zone_id=\"entrance\")\n\nfor frame in video:\n    detections = pf.detections.from_ultralytics(model.predict(frame))\n    detections = tracker.update(detections)\n    zones.update(detections)\n\n    frame = pf.annotate.box(frame, detections)\n    frame = pf.annotate.label(frame, detections)\n    frame = pf.annotate.zones(frame, zones)\n\n    if pf.show_frame(\"Live\", frame) == ord('q'):\n        break\n```\n\n## Installation\n\n```bash\npip install pixelflow\n```\n\n## Core Concepts\n\n### Detections - One Format, Every Framework\n\nConvert outputs from any ML framework into a unified format:\n\n```python\nimport pixelflow as pf\n\n# Ultralytics YOLO\nfrom ultralytics import YOLO\nmodel = YOLO(\"yolo11n.pt\")\ndetections = pf.detections.from_ultralytics(model.predict(image))\n\n# Detectron2\nfrom detectron2.engine import DefaultPredictor\npredictor = DefaultPredictor(cfg)\ndetections = pf.detections.from_detectron2(predictor(image), class_names=[\"person\", \"car\"])\n\n# HuggingFace Transformers\nfrom transformers import pipeline\ndetector = pipeline(\"object-detection\")\ndetections = pf.detections.from_transformers(detector(image))\n\n# Florence-2\ndetections = pf.detections.from_florence2(model_output)\n\n# SAM (Segment Anything)\ndetections = pf.detections.from_sam(masks, scores)\n\n# OCR Engines\ndetections = pf.detections.from_tesseract(tesseract_output)\ndetections = pf.detections.from_paddleocr(paddleocr_output)\ndetections = pf.detections.from_easyocr(easyocr_output)\n```\n\n### Powerful Filtering\n\nChain filters for complex queries with zero overhead:\n\n```python\n# Get high-confidence people in the parking zone, tracked for 5+ seconds\nresults = (detections\n    .filter_by_confidence(min_confidence=0.7)\n    .filter_by_class_id(\"person\")\n    .filter_by_zones([\"parking_lot\"])\n    .filter_by_tracking_duration(min_seconds=5.0))\n\n# Size-based filtering\nlarge_objects = detections.filter_by_size(min_area=10000)\ntall_objects = detections.filter_by_dimensions(min_height=200)\nsquares = detections.filter_by_aspect_ratio(min_ratio=0.9, max_ratio=1.1)\n\n# Spatial filtering\nleft_side = detections.filter_by_position(max_x=frame_width // 2)\n\n# Remove overlapping detections\nunique = detections.remove_duplicates(iou_threshold=0.5)\n\n# OCR-specific filters\ntitles = detections.filter_by_text_level(\"title\")\nenglish_text = detections.filter_by_text_language(\"en\")\n```\n\n### Media Handling\n\nPurpose-built classes for videos, cameras, and images:\n\n```python\nimport pixelflow as pf\n\n# Read a video file\nvideo = pf.VideoReader(\"video.mp4\", width=640)\nprint(f\"{video.width}x{video.height}, {video.fps}fps, {len(video)} frames\")\n\nfor frame in video:       # Replayable — resets on each iteration\n    if pf.show_frame(\"Preview\", frame) == ord('q'):\n        break\n\n# Load a single image\nimage = pf.read_image(\"photo.jpg\", width=640)\n\n# Webcam / network stream\ncam = pf.CameraStream(0, width=640)\ncam = pf.CameraStream(\"rtsp://camera.local/stream\")\n\n# Write processed video\nwriter = pf.VideoWriter(\"output.mp4\", fps=video.fps)\nfor frame in video:\n    processed = process(frame)\n    writer.write(processed)\nwriter.close()\n```\n\n### Zone-Based Analytics\n\nDefine spatial regions and track what enters them:\n\n```python\nimport pixelflow as pf\n\nzones = pf.Zones()\n\n# Define zones with different trigger strategies\nzones.add_zone(\n    polygon=[(100, 400), (300, 400), (300, 600), (100, 600)],\n    zone_id=\"entrance\",\n    name=\"Main Entrance\",\n    trigger_strategy=\"bottom_center\"  # Trigger when bottom-center of bbox enters\n)\n\nzones.add_zone(\n    polygon=[(500, 200), (700, 200), (700, 500), (500, 500)],\n    zone_id=\"restricted\",\n    trigger_strategy=\"percentage\",\n    overlap_threshold=0.3  # Trigger when 30% of bbox is inside\n)\n\n# Update detections with zone info\nzones.update(detections)\n\n# Access zone statistics\nprint(zones.get_zone_counts())  # {'entrance': 3, 'restricted': 1}\nprint(zones.get_zone_stats())   # Detailed stats including total_entered\n\n# Filter by zone\nentrance_only = zones.filter_by_zones(detections, [\"entrance\"])\nnot_restricted = zones.filter_by_zones(detections, [\"restricted\"], exclude=True)\n```\n\n**Trigger Strategies:**\n- `center` - Bounding box center point (default)\n- `bottom_center` - Bottom-center point (great for people/vehicles)\n- `percentage` - Percentage of bbox overlap\n- `overlap` - Any intersection\n- Multiple strategies with `mode=\"any\"` or `mode=\"all\"`\n\n### Object Tracking\n\nBuilt-in ByteTrack for multi-object tracking:\n\n```python\nimport pixelflow as pf\n\ntracker = pf.tracker.ByteTracker()\n\nfor frame in media.frames:\n    detections = pf.detections.from_ultralytics(model.predict(frame))\n    detections = tracker.update(detections)\n\n    for det in detections:\n        print(f\"Track ID: {det.tracker_id}, Class: {det.class_name}\")\n        print(f\"First seen: {det.first_seen_time}, Duration: {det.total_time}s\")\n```\n\n### Rich Annotations\n\nBeautiful, customizable visualizations:\n\n```python\nimport pixelflow as pf\n\n# Bounding boxes and labels\nframe = pf.annotate.box(frame, detections, thickness=2)\nframe = pf.annotate.label(frame, detections, font_scale=0.6)\n\n# Segmentation masks\nframe = pf.annotate.mask(frame, detections, opacity=0.4)\n\n# Keypoints and skeletons (pose estimation)\nframe = pf.annotate.keypoint(frame, detections)\nframe = pf.annotate.keypoint_skeleton(frame, detections)\n\n# Zone visualization\nframe = pf.annotate.zones(frame, zones)\nframe = pf.annotate.crossings(frame, crossings)\n\n# Privacy protection\nframe = pf.annotate.blur(frame, detections, kernel_size=51)\nframe = pf.annotate.pixelate(frame, detections, pixel_size=15)\n\n# Shapes\nframe = pf.annotate.oval(frame, detections)\nframe = pf.annotate.polygon(frame, detections)\n```\n\n### Image Transforms\n\nComprehensive image and detection-aware transformations:\n\n```python\nimport pixelflow as pf\n\n# Image-only transforms\nrotated = pf.transform.rotate(image, 45)\nflipped = pf.transform.flip_horizontal(image)\ncropped = pf.transform.crop(image, [100, 50, 500, 400])\n\n# Enhancement\nenhanced = pf.transform.clahe(image)\ngray = pf.transform.to_grayscale(image)\ncorrected = pf.transform.gamma_correction(image, gamma=1.2)\n\n# Detection-aware transforms (coordinates update automatically)\nrotated_img, rotated_dets = pf.transform.rotate_detections(image, detections, 45)\nflipped_img, flipped_dets = pf.transform.flip_horizontal_detections(image, detections)\ncropped_img, cropped_dets = pf.transform.crop_detections(image, detections, bbox=[100, 50, 500, 400])\n\n# Automatic inverse transforms (undo all transforms)\noriginal_coords = pf.transform.inverse_transforms(transformed_detections)\n```\n\n### Sliced Inference for Large Images\n\nDetect small objects in high-resolution images:\n\n```python\nimport pixelflow as pf\n\nslicer = pf.SlicedInference(\n    slice_height=640,\n    slice_width=640,\n    overlap_ratio_h=0.2,\n    overlap_ratio_w=0.2\n)\n\ndef detector(image):\n    return pf.detections.from_ultralytics(model.predict(image))\n\n# Run on 4K image - automatically slices, detects, and merges\nlarge_image = cv2.imread(\"satellite.jpg\")  # 4000x3000\ndetections = slicer.predict(large_image, detector)\n```\n\n### Line Crossing Detection\n\nTrack objects crossing defined lines:\n\n```python\nimport pixelflow as pf\n\ncrossings = pf.Crossings()\ncrossings.add_line(\n    start=(100, 300),\n    end=(500, 300),\n    line_id=\"entry_line\",\n    direction=\"down\"  # Only count downward crossings\n)\n\nfor frame in media.frames:\n    detections = tracker.update(pf.detections.from_ultralytics(model.predict(frame)))\n    crossings.update(detections)\n\n    print(f\"Crossed: {crossings.get_counts()}\")\n    frame = pf.annotate.crossings(frame, crossings)\n```\n\n### Serialization\n\nExport and import detection data:\n\n```python\n# To JSON\njson_str = detections.to_json()\n\n# To dictionary (for pandas, etc.)\ndata = detections.to_dict()\ndf = pd.DataFrame(data)\n\n# With metrics\nreport = detections.to_json_with_metrics()\n```\n\n## Supported Frameworks\n\n| Framework | Converter | Features |\n|-----------|-----------|----------|\n| Ultralytics (YOLO) | `from_ultralytics()` | Boxes, masks, keypoints |\n| Detectron2 | `from_detectron2()` | Boxes, masks, keypoints |\n| HuggingFace Transformers | `from_transformers()` | Boxes, scores |\n| Florence-2 | `from_florence2()` | Boxes, phrases |\n| SAM | `from_sam()` | Masks, scores |\n| Tesseract OCR | `from_tesseract()` | Text, boxes, confidence |\n| PaddleOCR | `from_paddleocr()` | Text, boxes, structure |\n| EasyOCR | `from_easyocr()` | Text, boxes |\n| PP-Structure | `from_ppstructure()` | Tables, formulas, layouts |\n\n## Documentation\n\nFull documentation available at [https://datamarkin.com/docs/pixelflow/](https://datamarkin.com/docs/pixelflow/)\n\n## Contributing\n\nContributions welcome! Please read our contributing guidelines.\n\n## License\n\nMIT License - see LICENSE file for details.\n\n---\n\nBuilt with love by [Datamarkin](https://datamarkin.com)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatamarkin%2Fpixelflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatamarkin%2Fpixelflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatamarkin%2Fpixelflow/lists"}