# cv::error: Out of memory in function 'cv::detail::MultiBandBlender::feed'

- **ID:** `opencv/image-stitching-out-of-memory`
- **Domain:** opencv
- **Category:** resource_error
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

The image stitching pipeline ran out of memory when trying to blend large images, typically due to high resolution or too many images in the panorama.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 4.7.0 | active | — | — |
| 4.8.0 | active | — | — |
| 4.9.0 | active | — | — |

## Workarounds

1. **Reduce image resolution before stitching: cv::resize each image to 50% using INTER_AREA, then run stitching. For example: cv::resize(img, img, cv::Size(), 0.5, 0.5, cv::INTER_AREA).** (90% success)
   ```
   Reduce image resolution before stitching: cv::resize each image to 50% using INTER_AREA, then run stitching. For example: cv::resize(img, img, cv::Size(), 0.5, 0.5, cv::INTER_AREA).
   ```
2. **Use the 'scans' or 'affine' warper type in cv::Stitcher::create which uses less memory than the default 'spherical' warper.** (80% success)
   ```
   Use the 'scans' or 'affine' warper type in cv::Stitcher::create which uses less memory than the default 'spherical' warper.
   ```

## Dead Ends

- **Increasing the system swap space without reducing image size** — Swap space does not help with GPU memory or large CPU allocations; the blender still fails due to insufficient RAM. (70% fail)
- **Switching to CUDA backend without checking GPU memory limits** — GPU memory is often more limited than system RAM; this can cause out-of-memory errors faster. (85% fail)
