Files
negative-converter/CLAUDE.md
Christoph K. 65b411b23d chore: initial project scaffold from architecture design
- Add CLAUDE.md with project overview, tech stack, build commands,
  architecture description, coding standards, and sample images section
- Add full directory structure: src/, docs/, tests/, import/
- Add CMakeLists.txt with C++20, OpenCV/LibRaw/Qt6 dependencies,
  converter_core static lib, optional GUI, and GTest tests
- Add architecture documentation: ARCHITECTURE.md, PIPELINE.md, MODULES.md
- Add source skeletons for all pipeline stages:
  RawLoader, Preprocessor, NegativeDetector, Inverter, ColorCorrector,
  CropProcessor, OutputWriter, Pipeline, MainWindow, CliRunner, main.cpp
- Add initial test stubs for pipeline and rawloader
- Add sample ARW files in import/ for integration testing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 09:28:32 +01:00

2.9 KiB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project

C++ desktop app converting digitized analog film negatives (35mm, 120mm) to digital positives. Supports JPG/PNG and RAW input (CR2/NEF/ARW/DNG), outputs PNG/JPG with inversion, C41/B&W correction, auto-crop, and batch processing. Cross-platform: Windows/Linux/macOS.

Tech Stack

  • Language: C++20
  • Image processing: OpenCV 4.10+ and LibRaw 0.21+ (RAW demosaicing)
  • GUI: Qt 6.8 LTS (LGPLv3)
  • Build: CMake 3.20+, vcpkg (Windows), Ninja
  • CLI: Optional batch mode without GUI

Build Commands

# Linux (Ubuntu/Debian)
sudo apt install libopencv-dev libqt6widgets6 libraw-dev cmake ninja-build
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build

# Windows (vcpkg)
vcpkg install opencv[contrib] libraw qt6-base:x64-windows
cmake -B build -G Ninja -DCMAKE_TOOLCHAIN_FILE=vcpkg.cmake
cmake --build build

# macOS (Homebrew)
brew install opencv libraw qt@6 cmake ninja
cmake -B build -G Ninja
cmake --build build

Architecture

Processing pipeline:

Input → Loader → Preprocess → Detect → Invert → Color Correction → Post-Process → Output

Core data structure:

struct ImageData {
    cv::Mat rgb;      // Demosaiced 16-bit
    std::string make; // "Canon", "Nikon"
    float exposure;   // WB/EXIF data
};

Pipeline stages:

  1. Loader (src/converter/rawloader): LibRaw for RAW→RGB16, OpenCV for JPG/PNG
  2. Preprocess: RAW→RGB16 conversion, deskew
  3. Detect (src/converter/negative): Negative vs. positive via histogram analysis and orange color masking
  4. Invert: cv::bitwise_not() + film-specific color matrix
  5. Color: C41 orange cast removal, auto white balance from EXIF
  6. Post (src/converter/crop): Levels, sharpening, dust removal, auto frame detection
  7. Output: 16-bit TIFF and 8-bit PNG

Error handling uses std::expected<ImageData, Error> throughout.

Coding Standards

  • Always call LibRaw::recycle() after use
  • Qt file dialogs: QFileDialog::getOpenFileNames("RAW (*.cr2 *.nef *.dng)")
  • Tests use RAW golden files with pixel diff tolerance <1%
  • Do not exceed 4GB in-memory RAW data
  • Do not use lossy demosaicing (LibRaw default is lossless)
  • Always log RAW metadata

Sample Images

The import/ directory contains example RAW files for manual testing and development:

File Format Description
import/DSC09246.ARW Sony ARW Example negative for conversion testing
import/unbenannt.ARW Sony ARW Example negative for conversion testing

Use these files to test the full pipeline end-to-end without needing external test data.

License Compliance

README.md must include: