Metadata-Version: 2.4
Name: camera-flip
Version: 0.1.0
Summary: Live camera viewer with realtime flip controls and camera switching
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: opencv-python>=4
Requires-Dist: numpy>=1.23

# camera-flip

A small command-line camera viewer for flipping a live camera feed horizontally or vertically in real time.

`camera-flip` is useful when you want a quick local camera preview with keyboard controls for mirroring, rotating by flips, resetting the view, and switching between camera devices.

## Features

- Live camera preview using OpenCV
- Horizontal flip toggle
- Vertical flip toggle
- Reset flips instantly
- Switch between camera indexes `0` through `9`
- Heads-up display showing the active camera
- Safe fallback screen when a camera is unavailable
- Installable as a command-line tool

## Installation

### Install from GitHub

```bash
python -m pip install "git+https://github.com/PedroLopes/camera-flip.git"
```

After installation, run:

```bash
camera-flip
```

### Install locally for development

From the root of this repository:

```bash
python -m pip install -e .
```

Then run:

```bash
camera-flip
```

## Usage

Start with the default camera:

```bash
camera-flip
```

Start with a specific camera index:

```bash
camera-flip --camera 1
```

Short option:

```bash
camera-flip -c 1
```

## Keyboard controls

| Key | Action |
| --- | --- |
| `0`-`9` | Switch to camera index |
| `h` | Toggle horizontal flip |
| `v` | Toggle vertical flip |
| `r` | Reset flips |
| `q` | Quit |

## Project structure

```text
camera-flip/
├── pyproject.toml
├── README.md
└── src/
    └── camera_flip/
        ├── __init__.py
        └── cli.py
```

## Packaging configuration

This project uses `pyproject.toml` and exposes a command named `camera-flip`.

```toml
[build-system]
requires = ["setuptools>=77.0.3"]
build-backend = "setuptools.build_meta"

[project]
name = "camera-flip"
version = "0.1.0"
description = "Live camera viewer with realtime flip controls and camera switching"
readme = "README.md"
requires-python = ">=3.9"
dependencies = [
    "opencv-python>=4",
    "numpy>=1.23"
]

[project.scripts]
camera-flip = "camera_flip.cli:main"
```

## Requirements

- Python 3.9 or newer
- A working webcam or external camera
- OpenCV, installed automatically through `opencv-python`
- NumPy, installed automatically through `numpy`

## macOS camera permissions

On macOS, the first run may require camera permission. If the camera window opens but no image appears, check:

```text
System Settings → Privacy & Security → Camera
```

Make sure your terminal app, IDE, or Python launcher has permission to access the camera.

## Troubleshooting

### `camera-flip: command not found`

Make sure the package installed successfully:

```bash
python -m pip install -e .
```

If you installed inside a virtual environment, activate that environment before running the command.

### Camera does not open

Try another camera index:

```bash
camera-flip --camera 1
camera-flip --camera 2
```

You can also switch cameras while the app is running by pressing number keys `0` through `9`.

### OpenCV install issues

Upgrade `pip` first:

```bash
python -m pip install --upgrade pip
```

Then reinstall:

```bash
python -m pip install -e .
```

### Window does not respond to keys

Make sure the camera window is focused. Click the OpenCV window, then press `h`, `v`, `r`, number keys, or `q`.

## Development

Clone the repository:

```bash
git clone https://github.com/YOUR_USERNAME/camera-flip.git
cd camera-flip
```

Install in editable mode:

```bash
python -m pip install -e .
```

Run the command:

```bash
camera-flip
```

