# Exploring Blurriness in Image Stitching

**URL:** <https://forum.opencv.org/t/exploring-blurriness-in-image-stitching/19052>\
**Category:** Python\
**Tags:** stitching\
**Created:** [October 21, 2024, 8:30pm UTC](https://forum.opencv.org/t/exploring-blurriness-in-image-stitching/19052 "2024-10-21T20:30:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ssfantasy](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@ssfantasy](https://forum.opencv.org/u/ssfantasy)\
**Post date:** [October 21, 2024, 8:30pm UTC](https://forum.opencv.org/t/exploring-blurriness-in-image-stitching/19052/1 "2024-10-21T20:30:50Z")

</div>

My images have become blurred in certain areas after stitching. Could you please explain why this happens and which parameter can be adjusted to resolve it?

My code:

```python
import os
import cv2
import numpy as np
from PIL import Image, ImageFilter
from stitching import Stitcher, AffineStitcher
from tqdm import tqdm 

panorama = None
for i in tqdm(range(0, len(image_files), dynamic_block_size), desc="processing"):
    block = image_files[i:i + dynamic_block_size]

    images = [cv2.imread(img_file) for img_file in block]

    if any(img is None for img in images):
        continue

    if panorama is None:
        if len(images) == 1:
            result = images[0]
        else:
            result = stitcher.stitch(images) 
    else:
        tmp_images = []
        tmp_images = [] + images + [panorama]
        result = stitcher.stitch(tmp_images)

    if result is None:
        continue
    else:
        panorama = result 

```

My settings parameters are as follows：

```python
settings = {
"detector": "sift",
# "nfeatures": 1000,
"confidence_threshold": 0.5,
"crop": False,
"estimator": "affine",
"wave_correct_kind": "no",
"matcher_type": "affine",
"adjuster": "affine",
"warper_type": "affine",
"compensator": "no",
"medium_megapix": 0.8, # 0.5
"low_megapix": 0.5, # 0.1
"final_megapix": -1,
"range_width": -1,
"nr_feeds": 1,
"block_size": 32,
"try_use_gpu": True,
"blender_type": 'multiband',
"blend_strength": 1,
}

```

 ![final_panorama_github](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/8/88df8059f81cf29d7903b98b592d0f9bf5c65d33.jpeg)

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [October 21, 2024, 8:53pm UTC](https://forum.opencv.org/t/exploring-blurriness-in-image-stitching/19052/2 "2024-10-21T20:53:56Z")

</div>

that bunch of config data doesn’t mean anything on its own.

what _code_ are you running?

---

<div class="post-metadata">

**Author:** ![ssfantasy](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@ssfantasy](https://forum.opencv.org/u/ssfantasy)\
**Post date:** [October 21, 2024, 10:18pm UTC](https://forum.opencv.org/t/exploring-blurriness-in-image-stitching/19052/3 "2024-10-21T22:18:53Z")

</div>

Hello, thank you for the reminder. I have updated my code.

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [October 22, 2024, 6:39am UTC](https://forum.opencv.org/t/exploring-blurriness-in-image-stitching/19052/4 "2024-10-22T06:39:06Z")

</div>

> [@ssfantasy](#):
>
> ```auto
> tmp_images = [] + images + [panorama]
> result = stitcher.stitch(tmp_images)
> 
> ```

because of that.

what happens when you copy a sheet of paper, and then take the _copy_ and copy that again, and so on?

_that_ is what happens.

---

<div class="post-metadata">

**Author:** ![ssfantasy](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@ssfantasy](https://forum.opencv.org/u/ssfantasy)\
**Post date:** [October 22, 2024, 7:28am UTC](https://forum.opencv.org/t/exploring-blurriness-in-image-stitching/19052/5 "2024-10-22T07:28:56Z")

</div>

Could you please provide me with some guidance on how to handle this situation? Each of my images is approximately 12MB in size, and when I attempt to concatenate multiple images directly into a list, I encounter memory errors with OpenCV. As a result, I have been employing a step-by-step concatenation approach. Thank you for your assistance!
