# Denoise and sharpen

Image can be enhanced in few ways, it can be denoised and it can be sharpened (deblurred).

<table><thead><tr><th width="208.33333333333331">Enhancement</th><th>Description</th><th data-type="content-ref"></th></tr></thead><tbody><tr><td>denoise</td><td>Reduces the image noise</td><td><a href="#noise-removal">#noise-removal</a></td></tr><tr><td>deblur</td><td>Sharpen the image</td><td><a href="#out-of-focus-blur-reduction">#out-of-focus-blur-reduction</a></td></tr><tr><td>clean</td><td>Cleans the image without changing resolution</td><td></td></tr><tr><td>face_enhance</td><td></td><td><a href="enhance-face-details">enhance-face-details</a></td></tr><tr><td>light</td><td></td><td><a href="enhance-lighting-and-colors">enhance-lighting-and-colors</a></td></tr><tr><td>color</td><td></td><td><a href="enhance-lighting-and-colors">enhance-lighting-and-colors</a></td></tr><tr><td>white_balance</td><td></td><td><a href="../technology/enhance-lighting">enhance-lighting</a></td></tr></tbody></table>

Version of model for denoise or deblur can be parametrized.

There are two models: v1 and v2. v2 which is newer, handles better heavily blurry and noisy pictures. By default v1 is used.

It is not recommended to use that for good quality pictures though.

```json
"denoise_parameters": {
    "type": "v2"
}
```

```json
"deblur_parameters": {
    "type": "v2"
}
```

Let's check some examples.

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2FE1CFdSwhOgsjaq05pJWR%2Fperfume-678828_1920-noise.jpg?alt=media&#x26;token=f66e283f-fa94-493f-8fce-371f7f7d803c" alt=""><figcaption></figcaption></figure>

#### Noise removal

```json
{
    "enhancements": ["denoise"],
    "denoise_parameters": {
        "type": "v2"
    }
}
```

{% tabs %}
{% tab title="Curl" %}

```
curl --request POST \
     --url https://deep-image.ai/rest_api/process_result \
     --header 'content-type: application/json' \
     --header 'x-api-key: API_KEY' \
     --data '{
         "url": "https://deep-image.ai/api-example.png",
         "enhancements": ["denoise"],
         "denoise_parameters": {
           "type": "v2"
         }
      }'
```

{% endtab %}

{% tab title="Python client" %}

```python
import os

import deep_image_ai_client

configuration = deep_image_ai_client.Configuration(
    host="https://deep-image.ai"
)

configuration.api_key['ApiKeyAuth'] = os.environ["API_KEY"]

with deep_image_ai_client.ApiClient(configuration) as api_client:
    api_instance = deep_image_ai_client.DefaultApi(api_client)
    process_payload = {"url": "https://deep-image.ai/api-example.jpg", "enhancements": ["denoise"],
                       "denoise_parameters": {
                           "type": "v2"
                       }}
    api_response = api_instance.rest_api_process_result_post(process_payload)

```

{% endtab %}
{% endtabs %}

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2F3A3ipv85en5vfvSfsQtX%2Fperfume-678828_1920-noise-denoised.jpg?alt=media&#x26;token=2bc8a80f-34c5-43f9-8c1e-4adbdb61e082" alt=""><figcaption></figcaption></figure>

#### Out of focus blur reduction

We can also make sharper blurry image like this:

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2FVRmeWHgrkb1UdxWp9qn2%2Fimage.png?alt=media&#x26;token=8f455c09-5a3d-4d58-86bf-020c64530723" alt=""><figcaption></figcaption></figure>

```json
{
    "enhancements": ["deblur"]
}
```

{% tabs %}
{% tab title="Curl" %}

```
curl --request POST \
     --url https://deep-image.ai/rest_api/process_result \
     --header 'content-type: application/json' \
     --header 'x-api-key: API_KEY' \
     --data '{
         "url": "https://deep-image.ai/api-example.png",
         "enhancements": ["deblur"]
      }'
```

{% endtab %}

{% tab title="Python client" %}

```python
import os

import deep_image_ai_client

configuration = deep_image_ai_client.Configuration(
    host="https://deep-image.ai"
)

configuration.api_key['ApiKeyAuth'] = os.environ["API_KEY"]

with deep_image_ai_client.ApiClient(configuration) as api_client:
    api_instance = deep_image_ai_client.DefaultApi(api_client)
    process_payload = {"url": "https://deep-image.ai/api-example.jpg", "enhancements": ["deblur"]}
    api_response = api_instance.rest_api_process_result_post(process_payload)

```

{% endtab %}
{% endtabs %}

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2FZyirV8KwTgvKRsw24WEY%2Fperfume-678828_1920-blur-sharpened.jpg?alt=media&#x26;token=b7bf6666-6e43-4088-8730-90fdb006d333" alt=""><figcaption></figcaption></figure>

&#x20;Those two options can be specified together.

Let's check the results on that image:

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2FucbPzwvwjMPYUQJIRmz6%2Fperfume-678828_1920-blur-noise.jpg?alt=media&#x26;token=0823fb1f-d96a-4401-ac44-35c7c66203e4" alt=""><figcaption></figcaption></figure>

```json
{
    "enhancements": ["deblur", "denoise"]
}
```

{% tabs %}
{% tab title="Curl" %}

```
curl --request POST \
     --url https://deep-image.ai/rest_api/process_result \
     --header 'content-type: application/json' \
     --header 'x-api-key: API_KEY' \
     --data '{
         "url": "https://deep-image.ai/api-example.png",
         "enhancements": ["deblur", "denoise"]
      }'
```

{% endtab %}

{% tab title="Python client" %}

```python
import os

import deep_image_ai_client

configuration = deep_image_ai_client.Configuration(
    host="https://deep-image.ai"
)

configuration.api_key['ApiKeyAuth'] = os.environ["API_KEY"]

with deep_image_ai_client.ApiClient(configuration) as api_client:
    api_instance = deep_image_ai_client.DefaultApi(api_client)
    process_payload = {"url": "https://deep-image.ai/api-example.jpg", "enhancements": ["deblur", "denoise"]}
    api_response = api_instance.rest_api_process_result_post(process_payload)

```

{% endtab %}
{% endtabs %}

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2FlG60dgFl8s2qIUnC8bXp%2Fperfume-678828_1920-blur-noise-denoised_sharpened.jpg?alt=media&#x26;token=088695c2-5a54-4bb5-8a9f-fc6e9b799698" alt=""><figcaption></figcaption></figure>

#### Cleaning the image

Image can also be "cleaned" from artifacts and previously poorly upscaled image.

```json
"enhancements": ["clean"]
```

{% tabs %}
{% tab title="Curl" %}

```
curl --request POST \
     --url https://deep-image.ai/rest_api/process_result \
     --header 'content-type: application/json' \
     --header 'x-api-key: API_KEY' \
     --data '{
         "url": "https://deep-image.ai/api-example.png",
         "enhancements": ["clean"]
      }'
```

{% endtab %}

{% tab title="Python client" %}

```python
import os

import deep_image_ai_client

configuration = deep_image_ai_client.Configuration(
    host="https://deep-image.ai"
)

configuration.api_key['ApiKeyAuth'] = os.environ["API_KEY"]

with deep_image_ai_client.ApiClient(configuration) as api_client:
    api_instance = deep_image_ai_client.DefaultApi(api_client)
    process_payload = {"url": "https://deep-image.ai/api-example.jpg", "enhancements": ["clean"]}
    api_response = api_instance.rest_api_process_result_post(process_payload)

```

{% endtab %}
{% endtabs %}

Resolution of the image remains the same but image should be in better quality.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.deep-image.ai/image-processing/denoise-and-sharpen.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
