StitchAI — Industrial Vision and CNC Automation System
A fully integrated AI-powered vision and CNC automation system for manufacturing

StitchAI is a comprehensive automation platform designed to transform manufacturing workflows by integrating real-time computer vision, segmentation, motion planning, and CNC machine control.
Rather than relying on pre-designed DXF files, StitchAI captures raw visual data directly from industrial cameras, processes it through advanced algorithms, and automates production via G-code generation and CNC communication.
Key Modules:
- Vision Processing: Real-time capture, correction, and enhancement of raw images via Basler cameras.
- Perspective Calibration: Accurate 4-point matrix calibration for real-world coordinate mapping.
- AI-Powered Segmentation: Integrated Segment Anything Model (SAM) with support for manual refinement and morphological operations.
- Path Planning: Geometrically optimized route generation with offset calculations and intelligent processing order.
- G-code Generation: High-fidelity G-code output with simulation and visual verification.
- Machine Communication: Full Modbus (RTU/TCP) support, serial/Ethernet I/O, and real-time monitoring of CNC and PLC systems.
- Workflow Automation: Batch processing, job parameter management, and recipe-driven execution.
Industrial Applications:
- Textile and Leather Processing: Automated stitching and cutting guided by computer vision.
Technology Stack:
- Frontend/UI: PyQt6 for a high-performance desktop interface
- Computer Vision: OpenCV, NumPy, pypylon
- AI & Segmentation: PyTorch, Segment Anything Model (Meta AI)
- Geometric Computation: Shapely, ezdxf
- CNC & Communication: pymodbus, pyserial
Core Features:
- Perspective & affine coordinate transformation
- SAM-based AI segmentation and manual overrides
- Edge detection and contour tracing
- Geometry-based G-code generation with toolpath compensation
- Real-time machine state monitoring and manual override support
Example Use Cases:
- Full automatic processing: From image capture to CNC execution with a single click
- Manual segmentation and route adjustment workflows
- DXF import and G-code generation from predefined vectors
Workflow Overview:
- Calibrate camera perspective and align coordinates
- Capture real-time material imagery
- Segment regions of interest (automatically or manually)
- Optimize toolpaths and configure process parameters
- Generate and simulate G-code
- Execute via Modbus-connected CNC machine
Troubleshooting & Diagnostics:
- Visual aids for camera alignment and lighting conditions
- SAM model error handling and contrast optimization
- Communication diagnostics for PLC and CNC integration
This solution is designed for manufacturers seeking precision, flexibility, and full-stack automation from image to execution.