Image can be enhanced in few ways, it can be denoised and it can be sharpened (deblurred).
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.
"denoise_parameters": {
"type": "v2"
}
"deblur_parameters": {
"type": "v2"
}
Let's check some examples.
Noise removal
{
"enhancements": ["denoise"],
"denoise_parameters": {
"type": "v2"
}
}
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"
}
}'
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)
Out of focus blur reduction
We can also make sharper blurry image like this:
{
"enhancements": ["deblur"]
}
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"]
}'
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)
Those two options can be specified together.
Let's check the results on that image:
{
"enhancements": ["deblur", "denoise"]
}
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"]
}'
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)
Cleaning the image
Image can also be "cleaned" from artifacts and previously poorly upscaled image.
"enhancements": ["clean"]
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"]
}'
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)
Resolution of the image remains the same but image should be in better quality.