In the pharmaceutical industry, Quality Control (QC) is critical. A single defective blister pack reaching a consumer can have severe health and legal consequences. This project involved building a high-speed Visual Inspection System designed to redefine precision through the fusion of C++, hardware synchronization, and AI.
High-speed production lines present a unique set of engineering hurdles:
I implemented the MVVM (Model-View-ViewModel) pattern to decouple the heavy computational backend logic from the modern QML user interface. This separation ensures that the UI remains highly responsive even when the system is processing massive data throughput from high-speed production lines.
To maximize system reliability, the AI inference engine operates as a separate process managed via QProcess.
This architectural choice creates a "sandboxing" effect: even if a complex AI algorithm encounters an unexpected edge case and crashes, the core production line interface remains unaffected, preventing costly industrial downtime.
I designed a triple-thread architecture: UI Thread, Image Acquisition Thread, and Command Manager. To prevent race conditions, I utilized QMutex and Signal/Slot with QueuedConnections for thread-safe data transfer.
Rendering high-resolution RAW frames without UI lag was a major bottleneck. I customized the rendering pipeline by inheriting from QQuickPaintedItem to handle direct C++ coordinate calculations, resulting in seamless Zoom/Pan functionality even during full-speed production.
Utilizing the Producer-Consumer pattern, I developed the logic for PLC communication via Sockets. This ensures that every "Eject" signal for a defective product is delivered with microsecond precision.