Documentation ¶
Index ¶
Constants ¶
const ( // Insufficient balance, failed to open, please recharge and open again. FAILEDOPERATION_BALANCEINSUFFICIENT = "FailedOperation.BalanceInsufficient" // The face was filtered because it was too small. It is recommended that the face size is not less than 34x34 pixels. FAILEDOPERATION_FACESIZETOOSMALL = "FailedOperation.FaceSizeTooSmall" // The material has not been reviewed. FAILEDOPERATION_FUSEMATERIALNOTAUTH = "FailedOperation.FuseMaterialNotAuth" // The material does not exist. FAILEDOPERATION_FUSEMATERIALNOTEXIST = "FailedOperation.FuseMaterialNotExist" // Image decoding failed. FAILEDOPERATION_IMAGEDECODEFAILED = "FailedOperation.ImageDecodeFailed" // Image download failed. FAILEDOPERATION_IMAGEDOWNLOADERROR = "FailedOperation.ImageDownloadError" // The short edge resolution of the image is lower than 64 pixels. FAILEDOPERATION_IMAGERESOLUTIONTOOSMALL = "FailedOperation.ImageResolutionTooSmall" // The image after Base64 encoding exceeds in size. FAILEDOPERATION_IMAGESIZEEXCEED = "FailedOperation.ImageSizeExceed" // The image size is too large or too small and does not meet algorithm requirements. FAILEDOPERATION_IMAGESIZEINVALID = "FailedOperation.ImageSizeInvalid" // Internal service error. FAILEDOPERATION_INNERERROR = "FailedOperation.InnerError" // The face cannot be detected because the face box is too small. FAILEDOPERATION_NOFACEDETECTED = "FailedOperation.NoFaceDetected" // Parameter or value is invalid. FAILEDOPERATION_PARAMETERVALUEERROR = "FailedOperation.ParameterValueError" // The backend service timed out. FAILEDOPERATION_REQUESTTIMEOUT = "FailedOperation.RequestTimeout" // RPC request failed, typically due to algorithm service malfunction. FAILEDOPERATION_RPCFAIL = "FailedOperation.RpcFail" // The material face ID does not exist. FAILEDOPERATION_TEMPLATEFACEIDNOTEXIST = "FailedOperation.TemplateFaceIDNotExist" // Internal error. FAILEDOPERATION_UNKNOWERROR = "FailedOperation.UnKnowError" // Unknown error. FAILEDOPERATION_UNKNOWN = "FailedOperation.Unknown" // Activity ID is not found. INVALIDPARAMETERVALUE_ACTIVITYIDNOTFOUND = "InvalidParameterValue.ActivityIdNotFound" // Face box parameters are invalid, or the face box is too small. INVALIDPARAMETERVALUE_FACERECTPARAMETERVALUEERROR = "InvalidParameterValue.FaceRectParameterValueError" // No material ID is found. INVALIDPARAMETERVALUE_MATERIALIDNOTFOUND = "InvalidParameterValue.MaterialIdNotFound" // The URL format is invalid. INVALIDPARAMETERVALUE_URLILLEGAL = "InvalidParameterValue.UrlIllegal" // The number of requests exceeded the rate limit. REQUESTLIMITEXCEEDED = "RequestLimitExceeded" // Resources are insufficient. RESOURCEINSUFFICIENT = "ResourceInsufficient" // The resource does not exist. RESOURCENOTFOUND = "ResourceNotFound" // The account has been frozen. RESOURCEUNAVAILABLE_FREEZE = "ResourceUnavailable.Freeze" // The account is in arrears. RESOURCEUNAVAILABLE_INARREARS = "ResourceUnavailable.InArrears" // The service is being opened, please wait. RESOURCEUNAVAILABLE_ISOPENING = "ResourceUnavailable.IsOpening" // The billing status is unknown. Check whether the service has been activated in the console. RESOURCEUNAVAILABLE_NOTEXIST = "ResourceUnavailable.NotExist" // The resource has been possessed. RESOURCEUNAVAILABLE_RECOVER = "ResourceUnavailable.Recover" // Services for the account has been stopped. RESOURCEUNAVAILABLE_STOPUSING = "ResourceUnavailable.StopUsing" )
const APIVersion = "2022-09-27"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
func NewClient ¶
func NewClient(credential common.CredentialIface, region string, clientProfile *profile.ClientProfile) (client *Client, err error)
func NewClientWithSecretId ¶
Deprecated
func (*Client) FuseFace ¶
func (c *Client) FuseFace(request *FuseFaceRequest) (response *FuseFaceResponse, err error)
FuseFace This API is used to perform the fusion of a single face, multiple faces, and specified faces with the material template by uploading face images. Users can add logos to generated images. See <a href="https://intl.cloud.tencent.com/document/product/670/38247?from_cn_redirect=1" target="_blank">Fusion Access Guide</a>.
- The signature method in the public parameters must be specified as the V3 version. In other words, set the SignatureMethod parameter to TC3-HMAC-SHA256.
error code that may be returned:
FAILEDOPERATION_BALANCEINSUFFICIENT = "FailedOperation.BalanceInsufficient" FAILEDOPERATION_FACESIZETOOSMALL = "FailedOperation.FaceSizeTooSmall" FAILEDOPERATION_FUSEMATERIALNOTAUTH = "FailedOperation.FuseMaterialNotAuth" FAILEDOPERATION_FUSEMATERIALNOTEXIST = "FailedOperation.FuseMaterialNotExist" FAILEDOPERATION_IMAGEDECODEFAILED = "FailedOperation.ImageDecodeFailed" FAILEDOPERATION_IMAGEDOWNLOADERROR = "FailedOperation.ImageDownloadError" FAILEDOPERATION_IMAGERESOLUTIONTOOSMALL = "FailedOperation.ImageResolutionTooSmall" FAILEDOPERATION_IMAGESIZEEXCEED = "FailedOperation.ImageSizeExceed" FAILEDOPERATION_IMAGESIZEINVALID = "FailedOperation.ImageSizeInvalid" FAILEDOPERATION_INNERERROR = "FailedOperation.InnerError" FAILEDOPERATION_NOFACEDETECTED = "FailedOperation.NoFaceDetected" FAILEDOPERATION_PARAMETERVALUEERROR = "FailedOperation.ParameterValueError" FAILEDOPERATION_REQUESTTIMEOUT = "FailedOperation.RequestTimeout" FAILEDOPERATION_RPCFAIL = "FailedOperation.RpcFail" FAILEDOPERATION_TEMPLATEFACEIDNOTEXIST = "FailedOperation.TemplateFaceIDNotExist" FAILEDOPERATION_UNKNOWERROR = "FailedOperation.UnKnowError" FAILEDOPERATION_UNKNOWN = "FailedOperation.Unknown" INVALIDPARAMETERVALUE_ACTIVITYIDNOTFOUND = "InvalidParameterValue.ActivityIdNotFound" INVALIDPARAMETERVALUE_FACERECTPARAMETERVALUEERROR = "InvalidParameterValue.FaceRectParameterValueError" INVALIDPARAMETERVALUE_MATERIALIDNOTFOUND = "InvalidParameterValue.MaterialIdNotFound" INVALIDPARAMETERVALUE_URLILLEGAL = "InvalidParameterValue.UrlIllegal" REQUESTLIMITEXCEEDED = "RequestLimitExceeded" RESOURCEINSUFFICIENT = "ResourceInsufficient" RESOURCENOTFOUND = "ResourceNotFound" RESOURCEUNAVAILABLE_FREEZE = "ResourceUnavailable.Freeze" RESOURCEUNAVAILABLE_INARREARS = "ResourceUnavailable.InArrears" RESOURCEUNAVAILABLE_ISOPENING = "ResourceUnavailable.IsOpening" RESOURCEUNAVAILABLE_NOTEXIST = "ResourceUnavailable.NotExist" RESOURCEUNAVAILABLE_RECOVER = "ResourceUnavailable.Recover" RESOURCEUNAVAILABLE_STOPUSING = "ResourceUnavailable.StopUsing"
func (*Client) FuseFaceWithContext ¶
func (c *Client) FuseFaceWithContext(ctx context.Context, request *FuseFaceRequest) (response *FuseFaceResponse, err error)
FuseFace This API is used to perform the fusion of a single face, multiple faces, and specified faces with the material template by uploading face images. Users can add logos to generated images. See <a href="https://intl.cloud.tencent.com/document/product/670/38247?from_cn_redirect=1" target="_blank">Fusion Access Guide</a>.
- The signature method in the public parameters must be specified as the V3 version. In other words, set the SignatureMethod parameter to TC3-HMAC-SHA256.
error code that may be returned:
FAILEDOPERATION_BALANCEINSUFFICIENT = "FailedOperation.BalanceInsufficient" FAILEDOPERATION_FACESIZETOOSMALL = "FailedOperation.FaceSizeTooSmall" FAILEDOPERATION_FUSEMATERIALNOTAUTH = "FailedOperation.FuseMaterialNotAuth" FAILEDOPERATION_FUSEMATERIALNOTEXIST = "FailedOperation.FuseMaterialNotExist" FAILEDOPERATION_IMAGEDECODEFAILED = "FailedOperation.ImageDecodeFailed" FAILEDOPERATION_IMAGEDOWNLOADERROR = "FailedOperation.ImageDownloadError" FAILEDOPERATION_IMAGERESOLUTIONTOOSMALL = "FailedOperation.ImageResolutionTooSmall" FAILEDOPERATION_IMAGESIZEEXCEED = "FailedOperation.ImageSizeExceed" FAILEDOPERATION_IMAGESIZEINVALID = "FailedOperation.ImageSizeInvalid" FAILEDOPERATION_INNERERROR = "FailedOperation.InnerError" FAILEDOPERATION_NOFACEDETECTED = "FailedOperation.NoFaceDetected" FAILEDOPERATION_PARAMETERVALUEERROR = "FailedOperation.ParameterValueError" FAILEDOPERATION_REQUESTTIMEOUT = "FailedOperation.RequestTimeout" FAILEDOPERATION_RPCFAIL = "FailedOperation.RpcFail" FAILEDOPERATION_TEMPLATEFACEIDNOTEXIST = "FailedOperation.TemplateFaceIDNotExist" FAILEDOPERATION_UNKNOWERROR = "FailedOperation.UnKnowError" FAILEDOPERATION_UNKNOWN = "FailedOperation.Unknown" INVALIDPARAMETERVALUE_ACTIVITYIDNOTFOUND = "InvalidParameterValue.ActivityIdNotFound" INVALIDPARAMETERVALUE_FACERECTPARAMETERVALUEERROR = "InvalidParameterValue.FaceRectParameterValueError" INVALIDPARAMETERVALUE_MATERIALIDNOTFOUND = "InvalidParameterValue.MaterialIdNotFound" INVALIDPARAMETERVALUE_URLILLEGAL = "InvalidParameterValue.UrlIllegal" REQUESTLIMITEXCEEDED = "RequestLimitExceeded" RESOURCEINSUFFICIENT = "ResourceInsufficient" RESOURCENOTFOUND = "ResourceNotFound" RESOURCEUNAVAILABLE_FREEZE = "ResourceUnavailable.Freeze" RESOURCEUNAVAILABLE_INARREARS = "ResourceUnavailable.InArrears" RESOURCEUNAVAILABLE_ISOPENING = "ResourceUnavailable.IsOpening" RESOURCEUNAVAILABLE_NOTEXIST = "ResourceUnavailable.NotExist" RESOURCEUNAVAILABLE_RECOVER = "ResourceUnavailable.Recover" RESOURCEUNAVAILABLE_STOPUSING = "ResourceUnavailable.StopUsing"
type FaceRect ¶
type FaceRect struct { // Top-left X-axis coordinate of the face box X *int64 `json:"X,omitnil,omitempty" name:"X"` // Top-left Y-axis coordinate of the face box Y *int64 `json:"Y,omitnil,omitempty" name:"Y"` // Face box width Width *int64 `json:"Width,omitnil,omitempty" name:"Width"` // Face box height Height *int64 `json:"Height,omitnil,omitempty" name:"Height"` }
type FuseFaceRequest ¶
type FuseFaceRequest struct { *tchttp.BaseRequest // Activity ID. Check the ID in the <a href="https://console.cloud.tencent.com/facefusion" target="_blank"> Face Fusion console</a>. ProjectId *string `json:"ProjectId,omitnil,omitempty" name:"ProjectId"` // Material ID. Check the ID in the <a href="https://console.cloud.tencent.com/facefusion" target="_blank"> Face Fusion console</a>. ModelId *string `json:"ModelId,omitnil,omitempty" name:"ModelId"` // Image return method (url or base64). You cannot use both methods at the same time. The URL is valid for 7 days. RspImgType *string `json:"RspImgType,omitnil,omitempty" name:"RspImgType"` // Face position information on the user face image and material template image. No more than 6 entries. MergeInfos []*MergeInfo `json:"MergeInfos,omitnil,omitempty" name:"MergeInfos"` // Switch indicating whether to add a synthesis logo to the fusion result image. Default value: 1. // 1: add logo // 0: do not add logo // Other values: add logo // It is recommended to use an obvious logo to indicate that the result image uses face fusion technology and is synthesized by AI. LogoAdd *int64 `json:"LogoAdd,omitnil,omitempty" name:"LogoAdd"` // Logo content settings // By default, the text "Synthesized by AI" is added to the bottom right corner of the fusion result image. You can also use other texts. LogoParam *LogoParam `json:"LogoParam,omitnil,omitempty" name:"LogoParam"` // Fusion parameter. FuseParam *FuseParam `json:"FuseParam,omitnil,omitempty" name:"FuseParam"` }
func NewFuseFaceRequest ¶
func NewFuseFaceRequest() (request *FuseFaceRequest)
func (*FuseFaceRequest) FromJsonString ¶
func (r *FuseFaceRequest) FromJsonString(s string) error
FromJsonString It is highly **NOT** recommended to use this function because it has no param check, nor strict type check
func (*FuseFaceRequest) ToJsonString ¶
func (r *FuseFaceRequest) ToJsonString() string
type FuseFaceRequestParams ¶
type FuseFaceRequestParams struct { // Activity ID. Check the ID in the <a href="https://console.cloud.tencent.com/facefusion" target="_blank"> Face Fusion console</a>. ProjectId *string `json:"ProjectId,omitnil,omitempty" name:"ProjectId"` // Material ID. Check the ID in the <a href="https://console.cloud.tencent.com/facefusion" target="_blank"> Face Fusion console</a>. ModelId *string `json:"ModelId,omitnil,omitempty" name:"ModelId"` // Image return method (url or base64). You cannot use both methods at the same time. The URL is valid for 7 days. RspImgType *string `json:"RspImgType,omitnil,omitempty" name:"RspImgType"` // Face position information on the user face image and material template image. No more than 6 entries. MergeInfos []*MergeInfo `json:"MergeInfos,omitnil,omitempty" name:"MergeInfos"` // Switch indicating whether to add a synthesis logo to the fusion result image. Default value: 1. // 1: add logo // 0: do not add logo // Other values: add logo // It is recommended to use an obvious logo to indicate that the result image uses face fusion technology and is synthesized by AI. LogoAdd *int64 `json:"LogoAdd,omitnil,omitempty" name:"LogoAdd"` // Logo content settings // By default, the text "Synthesized by AI" is added to the bottom right corner of the fusion result image. You can also use other texts. LogoParam *LogoParam `json:"LogoParam,omitnil,omitempty" name:"LogoParam"` // Fusion parameter. FuseParam *FuseParam `json:"FuseParam,omitnil,omitempty" name:"FuseParam"` }
Predefined struct for user
type FuseFaceResponse ¶
type FuseFaceResponse struct { *tchttp.BaseResponse Response *FuseFaceResponseParams `json:"Response"` }
func NewFuseFaceResponse ¶
func NewFuseFaceResponse() (response *FuseFaceResponse)
func (*FuseFaceResponse) FromJsonString ¶
func (r *FuseFaceResponse) FromJsonString(s string) error
FromJsonString It is highly **NOT** recommended to use this function because it has no param check, nor strict type check
func (*FuseFaceResponse) ToJsonString ¶
func (r *FuseFaceResponse) ToJsonString() string
type FuseFaceResponseParams ¶
type FuseFaceResponseParams struct { // When RspImgType is set to url, return the URL (valid for 7 days). When RspImgType is set to base64, return the Base64 code. FusedImage *string `json:"FusedImage,omitnil,omitempty" name:"FusedImage"` // The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` }
Predefined struct for user
type FuseParam ¶
type FuseParam struct { // Image encoding parameter ImageCodecParam *ImageCodecParam `json:"ImageCodecParam,omitnil,omitempty" name:"ImageCodecParam"` }
type ImageCodecParam ¶
type ImageCodecParam struct { // Metadata. The number of metadata entries cannot exceed 1. MetaData []*MetaData `json:"MetaData,omitnil,omitempty" name:"MetaData"` }
type LogoParam ¶
type LogoParam struct { // Coordinates of the logo image in the fusion result image. The logo image will be stretched according to the coordinates. LogoRect *FaceRect `json:"LogoRect,omitnil,omitempty" name:"LogoRect"` // Logo image URL // ●Either the Base64 code or URL must be provided. If both are provided, URL prevails. // ●Supported image format: JPG or PNG LogoUrl *string `json:"LogoUrl,omitnil,omitempty" name:"LogoUrl"` // Logo image Base64 code // ●Either the Base64 code or URL must be provided. If both are provided, URL prevails. // ●Supported image format: JPG or PNG LogoImage *string `json:"LogoImage,omitnil,omitempty" name:"LogoImage"` }
type MergeInfo ¶
type MergeInfo struct { // Enter the image Base64 code. // ●Either the Base64 code or URL must be provided. If both are provided, URL prevails. // ●Material image limitation: face size in the image greater than 34×34 pixels; image size greater than 64×64 pixels. (After encoding, the image size may increase by about 30%. It is recommended to control the image size reasonably.) // ●Supported image format: JPG or PNG Image *string `json:"Image,omitnil,omitempty" name:"Image"` // Enter the image URL. // ●Either the Base64 code or URL must be provided. If both are provided, URL prevails. // ●Material image limitation: face size in the image greater than 34×34 pixels; image size greater than 64×64 pixels. (After encoding, the image size may increase by about 30%. It is recommended to control the image size reasonably.) // ●Supported image format: JPG or PNG Url *string `json:"Url,omitnil,omitempty" name:"Url"` // Face position information (face box) on the uploaded image // Width and height are no less than 30. InputImageFaceRect *FaceRect `json:"InputImageFaceRect,omitnil,omitempty" name:"InputImageFaceRect"` // Material face ID. If this parameter is left blank, the largest face is used by default. TemplateFaceID *string `json:"TemplateFaceID,omitnil,omitempty" name:"TemplateFaceID"` // Face position information (face box) on the template. If this parameter is left blank, the largest face is used by default. This parameter applies to scenes where custom material templates are used for fusion. // Width and height are no less than 30. TemplateFaceRect *FaceRect `json:"TemplateFaceRect,omitnil,omitempty" name:"TemplateFaceRect"` }