# groupgets/purethermal1-uvc-capture architecture

> Architecture diagram of the GitHub repository groupgets/purethermal1-uvc-capture, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/groupgets/purethermal1-uvc-capture
- Repository: https://github.com/groupgets/purethermal1-uvc-capture

## Overview

##### Project type and purpose
- This is an open-source collection of cross-platform UVC capture examples for the PureThermal 1/2 FLIR Lepton boards.
- It’s not a single monolithic app but rather a suite of small demo tools showing how to stream or snapshot thermal data via USB on macOS, Windows, Linux, and via Python.

##### File structure
- Top-level directories correspond to platforms or interfaces:
– avfoundation: a macOS Objective-C Xcode project using AVFoundation.
– mediafoundation: a Windows C++ solution illustrating Media Foundation + UVC extension units.
– python: cross-platform Python scripts using OpenCV or ctypes+libuvc.
– v4l2: Linux C examples (autotools) for direct V4L2 capture and uvcdynctrl control definitions.
- Build/deploy configs:
– avfoundation/PT1Recorder.xcodeproj, .xcworkspace for macOS build.
– mediafoundation/PureThermal.sln and .vcxproj for Windows.
– v4l2/autogen.sh + configure.ac + Makefile.am for Linux.
– python scripts have no build step but depend on OpenCV or libuvc.

##### Extract README insights
- Describes capture formats (BGR, RGB16, GRAY8, Y16 raw IR).
- Lists external dependencies: gstreamer, guvcview, python-opencv, libuvc, Windows SDK, v4l-utils, uvcdynctrl.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Hardware and Driver Layer
    PTBoard["PureThermal Board"]:::hardware
    USB["USB Subsystem<br/>(Kernel Driver / libusb / UVC Driver)"]:::driver
    PTBoard -->|"UVC"| USB

    %% macOS Lane
    subgraph "macOS (AVFoundation)" 
        direction TB
        AVFramework["AVFoundation Framework"]:::macos
        PT1App["PT1Recorder Sample App"]:::macos
    end
    USB -->|"UVC"| AVFramework
    AVFramework -->|"AVCaptureSession"| PT1App

    %% Windows Lane
    subgraph "Windows (Media Foundation)"
        direction TB
        MFFramework["Media Foundation Framework"]:::windows
        WinApp["PureThermal Sample App"]:::windows
    end
    USB -->|"UVC"| MFFramework
    MFFramework -->|"IMFSourceReader"| WinApp

    %% Linux Lane
    subgraph "Linux (V4L2)"
        direction TB
        V4L2Framework["V4L2 Capture Framework"]:::linux
        GrabApp["pt1-v4l2-grab Sample App"]:::linux
        DynCtrl["uvcdynctrl UVC Control Loader"]:::linux
    end
    USB -->|"UVC / v4l2"| V4L2Framework
    V4L2Framework -->|"v4l2 API"| GrabApp
    V4L2Framework -->|"uvcdynctrl"| DynCtrl

    %% Python Lane
    subgraph "Python (OpenCV / libuvc)"
        direction TB
        CVCap["Python OpenCV VideoCapture Demo"]:::python
        DevInfo["Python UVC Device Info Script"]:::python
        Radiometry["Python UVC Radiometry Script"]:::python
        UvcTypes["Python libuvc ctypes Module"]:::python
    end
    USB -->|"libuvc / cv2.VideoCapture"| CVCap
    USB -->|"libuvc"| DevInfo
    USB -->|"libuvc Radiometry"| Radiometry
    USB -->|"ctypes libuvc"| UvcTypes

    %% Legend
    subgraph "Legend"
        direction TB
        Hwd["Hardware"]:::hardware
        Drv["Driver"]:::driver
        AppNode["Application / Demo"]:::app
        LibNode["Framework / Library"]:::lib
    end

    %% Click Events
    click AVFramework "https://github.com/groupgets/purethermal1-uvc-capture/blob/master/avfoundation/PT1Recorder.xcodeproj"
    click AVFramework "https://github.com/groupgets/purethermal1-uvc-capture/blob/master/avfoundation/PT1Recorder.xcworkspace"
    click PT1App "https://github.com/groupgets/purethermal1-uvc-capture/tree/master/avfoundation/PT1Recorder/"
    click MFFramework "https://github.com/groupgets/purethermal1-uvc-capture/blob/master/mediafoundation/PureThermal/PureThermal.sln"
    click MFFramework "https://github.com/groupgets/purethermal1-uvc-capture/blob/master/mediafoundation/PureThermal/PureThermal.vcxproj"
    click WinApp "https://github.com/groupgets/purethermal1-uvc-capture/blob/master/mediafoundation/PureThermal/PureThermal.cpp"
    click V4L2Framework "https://github.com/groupgets/purethermal1-uvc-capture/blob/master/v4l2/Makefile.am"
    click GrabApp "https://github.com/groupgets/purethermal1-uvc-capture/blob/master/v4l2/grab/pt1-v4l2-grab.c"
    click DynCtrl "https://github.com/groupgets/purethermal1-uvc-capture/blob/master/v4l2/uvcdynctrl/ctrl_gen.py"
    click CVCap "https://github.com/groupgets/purethermal1-uvc-capture/blob/master/python/opencv-capture.py"
    click DevInfo "https://github.com/groupgets/purethermal1-uvc-capture/blob/master/python/uvc-deviceinfo.py"
    click Radiometry "https://github.com/groupgets/purethermal1-uvc-capture/blob/master/python/uvc-radiometry.py"
    click UvcTypes "https://github.com/groupgets/purethermal1-uvc-capture/blob/master/python/uvctypes.py"

    %% Styles
    classDef hardware fill:#bbbbbb,stroke:#333,stroke-width:1px
    classDef driver fill:#dddddd,stroke:#333,stroke-width:1px
    classDef macos fill:#cce5ff,stroke:#004085,stroke-width:1px
    classDef windows fill:#d4edda,stroke:#155724,stroke-width:1px
    classDef linux fill:#fff3cd,stroke:#856404,stroke-width:1px
    classDef python fill:#f5c6cb,stroke:#721c24,stroke-width:1px
    classDef app fill:#ffffff,stroke:#000000,stroke-width:1px
    classDef lib fill:#ffffff,stroke:#000000,stroke-width:1px
```
