Image Enhance

The image enhance API enlarges your image by 4X the original width and height, while simulatenously increasing the quality of the image.

To use this API, you need to enable the Enhance API when starting DeepStack

Starting DeepStack

Run the command below as it applies to the version you have installed

sudo docker run -e VISION-ENHANCE=True -v localstorage:/datastore -p 80:5000 deepquestai/deepstack

Basic Parameters

-e VISION-ENHANCE=True This enables the image enhance API.

-v localstorage:/datastore This specifies the local volume where DeepStack will store all data.

-p 80:5000 This makes DeepStack accessible via port 80 of the machine.

Example

Sample Image

../_images/sky.jpg
import requests
import base64

image_data = open("sky.jpg","rb").read()

response = requests.post("http://localhost:80/v1/vision/enhance",files={"image":image_data}).json()

print(response)
if response["success"] == True:
    enhance_base64 = response["base64"]
    image4X_byte = base64.b64decode(enhance_base64)

    # Write enhanced image to file
    with open(r"sky-4X.jpg", 'wb') as f_output:
        f_output.write(image4X_byte)

Response

{
    "success": True,
    "base64": ".........mabKicgSdq/3fSo6UfcH0pATmhEgST3phPHNKe1RuetUJn//2Q==",
    "width": 1840
    "height": 1036
}

The API returns a Base64 string which you can decode to get the 4 times enhanced output of the original image. It also returns the width and height of the enhanced image.

Enhanced Output

../_images/sky-4X.jpg

More Sample Images

../_images/car-park.jpg

**

../_images/fox.jpg

Enhanced Outputs

../_images/car-park-4X.jpg

**

../_images/fox-4X.jpg