Metadata-Version: 2.4
Name: prepimage
Version: 0.1.0
Summary: PrepImage — an image dataset toolkit (duplicate image finder, preprocessing, box/polygon annotation, and augmentation)
Author: Harsh Sachan, Shalini Kumari, Md Ashraful Haque, Sudeep Marwaha
License: MIT
Project-URL: Repository, https://github.com/harsh-iasri/prepimage
Keywords: image,dataset,preprocessing,annotation,augmentation,gui,pyside6,qt
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Environment :: X11 Applications :: Qt
Classifier: Topic :: Multimedia :: Graphics
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: PySide6>=6.6
Requires-Dist: Pillow>=10.0
Requires-Dist: ImageHash>=4.3
Requires-Dist: numpy>=1.24
Dynamic: license-file

# PrepImage

**PrepImage** is a desktop toolkit for preparing image datasets for computer
vision and machine learning projects. It bundles four workflows that are
normally spread across separate scripts — deduplication, geometric
preprocessing, annotation, and dataset augmentation — into one PySide6
(Qt) GUI application, so a raw folder of images can be cleaned, resized,
labeled, and expanded without leaving the app.

## What it does

### 1. Find Duplicates
Scans a folder for identical or visually near-identical images using
perceptual average-hashing (`imagehash`), groups matches together, and
lets you review each group and remove the redundant copies before they
end up in a training set.

### 2. Preprocess
Batch-crops every image in a folder to a square (removing excess evenly
from the longer side, never stretching/distorting), optionally resizes
the square result to a fixed target size, and renames files sequentially.
Includes a zoomable thumbnail gallery for reviewing the input set first.

### 3. Image Labeling
A full annotation workspace for building detection and segmentation
datasets on top of your images:
- **Bounding boxes** for object detection.
- **Polygons** (segmentation masks) for pixel-level labeling, with an
  optional rasterized mask PNG export.
- Per-image class labels, editable after the fact (right-click a shape
  or a list entry to relabel it).
- Undo/redo — whole-shape while browsing, and per-vertex while a polygon
  is still being drawn (`Ctrl+Z` / `Ctrl+Y`, or right-click to drop the
  last placed point).
- Export to **YOLO `.txt`**, **Pascal-VOC-style `.xml`**, or **`.json`**,
  with class names round-tripped through a per-folder `classes.txt` so
  relabeling a folder later doesn't lose your class names.
- Zoom/pan canvas, keyboard shortcuts, and an in-app shortcuts reference.

### 4. Data Augmentation
Expands a dataset by applying pixel-level and geometric augmentations,
in two modes:
- **Images-only** — augment a folder of images with no annotations to
  carry along.
- **Annotated dataset** — augment images *and* their existing box/polygon
  annotations together. Non-geometric augmentations (brightness,
  contrast, blur, saturation, noise, grayscale, sharpen) leave shape
  coordinates untouched; geometric ones (horizontal/vertical flip,
  90°/180°/270° rotation) transform the coordinates to match the new
  pixel layout, so every saved annotation still lines up with its image.

Augmented files follow the naming convention
`originalname_SHORTCODE1_SHORTCODE2_0001.ext`, so it's obvious at a
glance which combination of augmentations produced a given output.

## Install

### From PyPI (once published)
```bash
pip install prepimage
```

### From source (editable / dev mode)
```bash
git clone https://github.com/<your-username>/prepimage.git
cd prepimage/prepimage_pkg
pip install -e .
```

## Run

```bash
prepimage
```

or, without installing the console script:

```bash
python -m prepimage
```

## Requirements

- Python >= 3.9
- [PySide6](https://pypi.org/project/PySide6/) — Qt GUI framework
- [Pillow](https://pypi.org/project/Pillow/) — image I/O and processing
- [ImageHash](https://pypi.org/project/ImageHash/) — perceptual hashing for duplicate detection
- [NumPy](https://pypi.org/project/numpy/) — array operations for preprocessing/augmentation

All of the above are installed automatically as dependencies.

## Project layout

```
prepimage_pkg/
├── pyproject.toml
├── README.md
└── src/
    └── prepimage/
        ├── __init__.py
        ├── __main__.py          # entry point (`prepimage` / `python -m prepimage`)
        ├── app.py                # QMainWindow + navigation (QStackedWidget)
        ├── theme.py               # colors, fonts, global stylesheet
        ├── widgets.py              # ToolCard (painted card, hover zoom)
        ├── assets.py                # shared logo loading helper
        ├── duplicates.py            # duplicate-detection core logic
        ├── preprocess.py            # crop/resize/rename core logic
        ├── augment.py                # augmentation engine + box/polygon transforms
        └── screens/
            ├── __init__.py
            ├── home.py                # landing page (hero + 4 tool cards)
            ├── duplicates.py           # Find Duplicates screen
            ├── preprocess.py           # Preprocess screen
            ├── annotate.py             # Image Labeling screen (boxes + polygons)
            ├── augment.py              # Data Augmentation screen
            └── working.py              # shared "under construction" placeholder
```

## License

MIT

## Authors

- Harsh Sachan
- Shalini Kumari
- Md Ashraful Haque
- Sudeep Marwaha
