This Python script unpacks RAW Bayer MIPI-packed images (RAW10 or RAW12) into 16-bit RAW format.
- Supports RAW10 (4 pixels in 5 bytes) and RAW12 (2 pixels in 3 bytes) formats.
- Converts packed MIPI RAW to 16-bit little-endian format for easier processing and analysis.
- CLI-based, fast, and portable.
- Python 3.6+
- No external libraries required (only standard Python libraries)
python3 mipi_unpack.py <input_file.raw> <bit_depth> [-o <output_file.raw>]| Argument | Description |
|---|---|
<input_file.raw> |
Path to the MIPI packed RAW image |
<bit_depth> |
Bit depth: 10 for RAW10 or 12 for RAW12 |
-o, --output |
(Optional) Output filename |
Unpack RAW10 image:
python3 mipi_unpack.py image_raw10.raw 10Unpack RAW12 image with custom output filename:
python3 mipi_unpack.py image_raw12.raw 12 -o image_unpacked.raw- The output is a raw binary file where each pixel is stored as a 16-bit unsigned integer (little endian).
- You can load this in tools like ImageJ, MATLAB, OpenCV, or any image viewer that supports raw 16-bit input.
- Only supports MIPI packed RAW10 and RAW12 formats.
- Assumes byte-aligned data with no frame headers or footers.