$ show opencv/opencv
OpenCV is a comprehensive computer vision and machine learning library written primarily in C++ with bindings for Python, Java, JavaScript, Swift, and other languages. Its architecture is modular, with core modules for fundamental data structures (Mat, UMat, Scalar), image processing (imgproc), video I/O (videoio), deep neural network inference (dnn), feature detection (features), object detection (objdetect), camera calibration (calib), 3D geometry (geometry), point cloud processing (ptcloud), and more. The library provides a hardware abstraction layer (HAL) for CPU optimizations (SIMD, IPP, Carotene) and supports GPU acceleration via CUDA, OpenCL, and Vulkan backends. Key entry points include cv::imread/cv::imwrite for image loading, cv::VideoCapture for video streams, and cv::dnn::readNet for model inference. Data flows typically involve reading image or video data, applying processing pipelines (filtering, feature extraction, detection), and outputting results. External dependencies include vendored third-party libraries for image codecs (libjpeg-turbo, libwebp, libtiff, openjpeg), compression (zlib-ng), serialization (protobuf, flatbuffers), text shaping (harfbuzz), and linear algebra (mlas, clapack). The codebase is actively maintained with frequent commits, extensive test and performance benchmarks, and support for multiple platforms including Windows, Linux, macOS, Android, and iOS.
The LLM identified 3 files worth highlighting for reuse:
A generic, header-only non-maximum suppression (NMS) implementation that accepts a pluggable overlap function (e.g., IoU, IoA). It is self-contained, uses only standard C++ and OpenCV's Rect/Point types, and can be extracted into any project requiring NMS with custom overlap criteria. Demonstrates clean template design and efficient sorting-based suppression.
A standalone Base64 encoding and decoding utility with no external dependencies beyond standard C++ libraries. Provides encode/decode functions for strings and byte arrays. Could be reused in any C++ project needing Base64 conversion without pulling in large dependencies. Demonstrates careful handling of padding and character mapping.
An asynchronous promise/future pattern for non-blocking array operations. Provides AsyncPromise and AsyncArray classes that allow launching operations and retrieving results later. The implementation is self-contained, using only OpenCV's core types and standard threading primitives. This pattern can be extracted for any C++ project needing lightweight async execution without a full framework.