このページは、お客様の言語ではご利用いただけません。Huawei Cloudは、より多くの言語バージョンを追加するために懸命に取り組んでいます。ご協力ありがとうございました。

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
Software Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Defog

Updated on 2024-12-10 GMT+08:00

Function

When a camera takes photos in smoggy weather, the image quality will be poor because the shooting scene is unclear. This API removes both uniform and non-uniform haze from images using the image defog algorithm. After you upload the image to be processed, Defog returns the processed image to you.

Prerequisites

Before using Defog, you need to apply for the service and complete authentication. For details, see Applying for a Service and Authentication.

URI

URI format

POST /v1.0/vision/defog

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 JPEG, PNG, BMP, and WEBP.

file

Configure either this parameter or image.

File

Indicates the image file.

gamma

No

Float

Indicates the gamma correction value. The default value is 1.5. The value ranges from 0.1 to 10.

natural_look

No

Boolean

Indicates whether to keep the normal look. The default value is true. If the parameter is set to false, the image is defogged, but the visual effect may be unnatural.

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 (Method 1: Use a Base64-encoded image.)
    POST https://image.ap-southeast-1.myhuaweicloud.com/v1.0/vision/defog
        
    Request Header:   
    Content-Type:application/json
    X-Auth-Token: MIINRwYJKoZIhvcNAQcCoIINODCCDTQCAQExDTALBglghkgBZQMEAgEwgguVBgkqhkiG...    
    Request Body:
    {
      "image":"/9j/4AAQSkZJRgABAgEASABIAAD/4RFZRXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUAAAABAAAAYgEbAAUAAAABAAAAagEoAAMAAAABAAIAAAExAAIAAAAcAAAAcgEyAAIAAAAUAAAAjodpAAQAAAABAAAApAAAANAACvyAAAAnEAAK/IAAACcQQWRvYmUgUGhvdG9zaG9wIENTMyBXaW5kb3dzADIwMTc6MTA6MjAgMTA6NDU6MzYAAAAAA6ABAAMAAAAB//8AAKACAAQAAAABAAALIKADAAQAAAABAAAGQAAAAAAAAAAGAQMAAwAAAAEABgAAARoABQAAAAEAAAEeARsABQAAAAEAAAEmASgAAwAAAAEAAgAAAgEABAAAAAEAAAEuAgIABAAAAAEAABAj...",
      "gamma":1.5,
      "natural_look":true
    }
  • Example request (Method 2: Use an image file.)
    POST https://image.ap-southeast-1.myhuaweicloud.com/v1.0/vision/defog
        
    Request Header:   
    X-Auth-Token: MIINRwYJKoZIhvcNAQcCoIINODCCDTQCAQExDTALBglghkgBZQMEAgEwgguVBgkqhkiG... 
     
    Request Body(form-data):
    file: File (image file)
    gamma:1.5
    natural_look:true

Method 1: Use a Base64-encoded image.

  • Example successful response
    {
     "result":"/9j/4AAQSkZJRgABAgEASABIAAD/4RFZRXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUAAAABAAAAYgEbAAUAAAABAAAAagEoAAMAAAABAAIAAAExAAIAAAAcAAAAcgEyAAIAAAAUAAAAjodpAAQAAAABAAAApAAAANAACvyAAAAnEAAK/IAAACcQQWRvYmUgUGhvdG9zaG9wIENTMyBXaW5kb3dzADIwMTc6MTA6MjAgMTA6NDU6MzYAAAAAA6ABAAMAAAAB//8AAKACAAQAAAABAAALIKADAAQAAAABAAAGQAAAAAAAAAAGAQMAAwAAAAEABgAAARoABQAAAAEAAAEeARsABQAAAAEAAAEmASgAAwAAAAEAAgAAAgEABAAAAAEAAAEuAgIABAAAAAEAABAj..."
    }
  • Example failed response
    {
        "error_code": "AIS.0105",
        "error_msg": "Recognize Failed"
    }

Method 2: Use an image file.

  • Sample response

    When the API is successfully called, the byte stream of the image file is returned.

  • Failed sample 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.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback