ImageDB2 is a Python library for performing image analysis, indexing, and search operations on image data. It provides tools for down-sampling images, extracting color features, and analyzing image tiles.
## Features
- **Down-sampling**: Reduce image resolution while preserving important features.
- **Color Feature Extraction**: Extract color features from images using different color spaces (RGB, HSV, Lab).
- **Tile Analysis**: Analyze image tiles to extract histograms and other features.
- **Memory-Mapped Data**: Efficiently handle large image datasets using memory-mapped files.
When processing the example input file `TESTIMG.jpeg`, the following files are produced:
1.**Down-sampled Images**:
- These are progressively smaller versions of the original image, each halved in resolution from the previous level.
- **Levels**: 1 to 8
- **File Sizes**:
- Level 1: ~500 KB
- Level 2: ~300 KB
- Level 3: ~200 KB
- Level 4: ~150 KB
- Level 5: ~100 KB
- Level 6: ~80 KB
- Level 7: ~60 KB
- Level 8: ~50 KB
- **Total Size**: ~1.5 MB
- **Ratio**: ~1.25x the original image size
2.**Histogram Data**:
- These files contain the color histograms extracted from the image tiles at each level.
- **Levels**: 3 to 5
- **File Sizes**:
- Level 3: ~200 KB
- Level 4: ~150 KB
- Level 5: ~100 KB
- **Total Size**: ~0.5 MB
- **Ratio**: ~0.42x the original image size
3.**Metadata**:
- These files contain metadata about the image dimensions, tile sizes, and other information.
- **Levels**: 3 to 5
- **File Sizes**:
- Level 3: ~20 KB
- Level 4: ~20 KB
- Level 5: ~20 KB
- **Total Size**: ~0.1 MB
- **Ratio**: ~0.08x the original image size
4.**Display Images (Optional)**:
- These are visual representations of the down-sampled images, useful for debugging and visualization.
- **Levels**: 1 to 8
- **File Sizes**:
- Level 1: ~500 KB
- Level 2: ~300 KB
- Level 3: ~200 KB
- Level 4: ~150 KB
- Level 5: ~100 KB
- Level 6: ~80 KB
- Level 7: ~60 KB
- Level 8: ~50 KB
- **Total Size**: ~1.5 MB
- **Ratio**: ~1.25x the original image size
### Summary
- **Total Data Produced**: ~4.8 MB
- **Ratio to Original Image**: ~4.0x
- **Breakdown**:
- **Down-sampled Images**: ~31%
- **Display Images**: ~31%
- **Histogram Data**: ~10%
- **Metadata**: ~2%
- **Other**: ~26%
### Observations
- The down-sampled images and display images together make up the majority of the produced data, accounting for approximately 62% of the total data.
- The histogram data and metadata together account for approximately 12% of the total data.
- The remaining 26% of the data is comprised of other files and overhead.
### Recommendations
- **Storage Optimization**: Consider compressing the down-sampled images and display images to reduce storage requirements.
- **Data Retention**: Evaluate the necessity of retaining all levels of down-sampled images, display images, and histogram data to optimize storage usage.
- **Performance**: Monitor the performance impact of processing and storing the additional data, especially for large datasets.
- **Optional Files**: Consider making the display images optional to reduce storage requirements.
- **Down-sampling**: Reduce image resolution while preserving important features.
- **Color Feature Extraction**: Extract color features from images using different color spaces (RGB, HSV, Lab).
- **Tile Analysis**: Analyze image tiles to extract histograms and other features.
- **Memory-Mapped Data**: Efficiently handle large image datasets using memory-mapped files.
## Data Types, Sizes, and Structure of `lab.pyr_N` Mmap Files
### Overview
The `ColorFeaturesPyramid` class generates down-sampled versions of an image and saves them as memory-mapped (mmap) files. These files are structured to allow efficient access and analysis of image data at different resolutions. Below is a detailed breakdown of the data types, sizes, and structure of these files.
### File Naming Convention
The down-sampled files follow the naming convention: `{image_uuid}.{colorspace}.pyr_{level}.jpeg
- `{image_uuid}`: Unique identifier for the image.
- `{colorspace}`: Color space used (e.g., `lab`, `rgb`, `hsv`).