Updated on 2022-02-22 GMT+08:00

Dark Enhance

Function

This API is applicable to the scenarios where human eyes or machines cannot distinguish objects in the dark when photographing images. It enhances dark areas, so that objects in the dark areas are visible, highlighting the effective visual information in the images. After you upload the image to be processed, Dark Enhance returns the enhanced image to you.

Prerequisites

  • Before using Dark Enhance, you need to apply for the service and complete authentication. For details, see Applying for a Service and Authentication.
  • By default, the maximum number of concurrent API calls is 1. To increase concurrency, contact Huawei technical support.

URI

URI format

POST /v1.0/vision/dark-enhance

Request Message

Table 1 describes the request parameters.
Table 1 Parameter description

Parameter

Mandatory

Type

Description

image

Configure either this parameter or file.

String

Indicates the Base64 character string converted from the image. The size cannot exceed 10 MB. The supported image formats include JPG, PNG, and BMP.

file

Configure either this parameter or image.

File

Indicates the image file.

NOTE:
  • The request parameter is not recommended.
  • The parameter is reserved for the compatible services to support such API. The following will not provide the example request and response corresponding to the parameter.

brightness

No

Float

Indicates luminance. A larger value indicates higher luminance. The default value is 0.9. The value ranges from 0 to 1.

Response Message

  • Table 2 describes the response parameters of Base64-encoded character strings.
    Table 2 Parameter description

    Parameter

    Type

    Description

    result

    String

    Indicates the Base64 character string converted from the image when the API is successfully called.

    This parameter is not included when the API fails to be called.

    error_code

    String

    Indicates the error code of a failed API call. For details, see Error Codes.

    This parameter is not included when the API is successfully called.

    error_msg

    String

    Indicates the error message of a failed API call.

    This parameter is not included when the API is successfully called.

  • Table 3 describes the response parameters of image files.
    Table 3 Parameter description

    Parameter

    Type

    Description

    error_code

    String

    Indicates the error code of a failed API call. For details, see Error Codes.

    This parameter is not included when the API is successfully called.

    error_msg

    String

    Indicates the error message of a failed API call.

    This parameter is not included when the API is successfully called.

Examples

  • Example request (Use a Base64-encoded image.)
    POST https://image.ap-southeast-1.myhuaweicloud.com/v1.0/vision/dark-enhance
        
    Request Header:   
    Content-Type:application/json
    X-Auth-Token: MIINRwYJKoZIhvcNAQcCoIINODCCDTQCAQExDTALBglghkgBZQMEAgEwgguVBgkqhkiG...
         
    Request Body:
    {
      "image":"/9j/4AAQSkZJRgABAgEASABIAAD/4RFZRXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUAAAABAAAAYgEbAAUAAAABAAAAagEoAAMAAAABAAIAAAExAAIAAAAcAAAAcgEyAAIAAAAUAAAAjodpAAQAAAABAAAApAAAANAACvyAAAAnEAAK/IAAACcQQWRvYmUgUGhvdG9zaG9wIENTMyBXaW5kb3dzADIwMTc6MTA6MjAgMTA6NDU6MzYAAAAAA6ABAAMAAAAB//8AAKACAAQAAAABAAALIKADAAQAAAABAAAGQAAAAAAAAAAGAQMAAwAAAAEABgAAARoABQAAAAEAAAEeARsABQAAAAEAAAEmASgAAwAAAAEAAgAAAgEABAAAAAEAAAEuAgIABAAAAAEAABAj...",
      "brightness":0.9
    }
  • Example successful response
    {
     "result":"/9j/4AAQSkZJRgABAgEASABIAAD/4RFZRXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUAAAABAAAAYgEbAAUAAAABAAAAagEoAAMAAAABAAIAAAExAAIAAAAcAAAAcgEyAAIAAAAUAAAAjodpAAQAAAABAAAApAAAANAACvyAAAAnEAAK/IAAACcQQWRvYmUgUGhvdG9zaG9wIENTMyBXaW5kb3dzADIwMTc6MTA6MjAgMTA6NDU6MzYAAAAAA6ABAAMAAAAB//8AAKACAAQAAAABAAALIKADAAQAAAABAAAGQAAAAAAAAAAGAQMAAwAAAAEABgAAARoABQAAAAEAAAEeARsABQAAAAEAAAEmASgAAwAAAAEAAgAAAgEABAAAAAEAAAEuAgIABAAAAAEAABAj..."
    }
  • Example failed response
    {
        "error_code": "AIS.0105",
        "error_msg": "Recognize Failed"
    }

Return Value

  • Normal

    200

  • Abnormal

    Return Value

    Description

    400

    • The request cannot be understood by the server due to malformed syntax. The client should not repeat the request without modifications.
    • The request parameter is incorrect.

    401

    The request requires user authentication.

    403

    No operation permission.

    404

    The server has not found anything matching the Request-URI.

    500

    The server encountered an unexpected condition which prevented it from fulfilling the request.