Skip to content

Commit 8e8268a

Browse files
committed
Merge branch 'ci_17' into 'master' (merge request !86)
ci_17
2 parents 5dc05df + 0d8107c commit 8e8268a

File tree

11 files changed

+535
-15
lines changed

11 files changed

+535
-15
lines changed

ci.go

Lines changed: 120 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,10 +1266,10 @@ func (s *CIService) GetQRcode(ctx context.Context, name string, cover int, opt *
12661266
}
12671267

12681268
type GetQRcodeResultV2 struct {
1269-
XMLName xml.Name `xml:"Response"`
1270-
CodeStatus int `xml:"CodeStatus,omitempty"`
1269+
XMLName xml.Name `xml:"Response"`
1270+
CodeStatus int `xml:"CodeStatus,omitempty"`
12711271
QRcodeInfo []QRcodeInfo `xml:"QRcodeInfo,omitempty"`
1272-
ResultImage string `xml:"ResultImage,omitempty"`
1272+
ResultImage string `xml:"ResultImage,omitempty"`
12731273
}
12741274

12751275
// 二维码识别-下载时识别 https://cloud.tencent.com/document/product/436/54070
@@ -1831,6 +1831,37 @@ func (s *CIService) EffectPet(ctx context.Context, obj string) (*PetEffectResult
18311831
return &res, resp, err
18321832
}
18331833

1834+
type PetDetectOption struct {
1835+
DetectUrl string `url:"detect-url,omitempty"`
1836+
}
1837+
1838+
type PetDetectResult struct {
1839+
XMLName xml.Name `xml:"Response"`
1840+
ResultInfo []struct {
1841+
Score int `xml:"Score,omitempty"`
1842+
Name string `xml:"Name,omitempty"`
1843+
Location struct {
1844+
X int `xml:"X,omitempty"`
1845+
Y int `xml:"Y,omitempty"`
1846+
Height int `xml:"Height,omitempty"`
1847+
Width int `xml:"Width,omitempty"`
1848+
} `xml:"Location,omitempty"`
1849+
} `xml:"ResultInfo,omitempty"`
1850+
}
1851+
1852+
func (s *CIService) DetectPet(ctx context.Context, obj string, opt *PetDetectOption) (*PetDetectResult, *Response, error) {
1853+
var res PetDetectResult
1854+
sendOpt := &sendOptions{
1855+
baseURL: s.client.BaseURL.BucketURL,
1856+
method: http.MethodGet,
1857+
uri: "/" + encodeURIComponent(obj) + "?ci-process=detect-pet",
1858+
result: &res,
1859+
optQuery: opt,
1860+
}
1861+
resp, err := s.client.send(ctx, sendOpt)
1862+
return &res, resp, err
1863+
}
1864+
18341865
type AILicenseRecOptions struct {
18351866
DetectUrl string `url:"detect-url,omitempty"`
18361867
CardType string `url:"CardType,omitempty"`
@@ -2296,6 +2327,23 @@ func (s *CIService) GetAIImageColoring(ctx context.Context, name string) (*Respo
22962327
return resp, err
22972328
}
22982329

2330+
// AIImageColoringOptions TODO
2331+
type AIImageColoringOptions struct {
2332+
DetectUrl string `url:"detect-url,omitempty"`
2333+
}
2334+
2335+
func (s *CIService) GetAIImageColoringV2(ctx context.Context, name string, opt *AIImageColoringOptions) (*Response, error) {
2336+
sendOpt := sendOptions{
2337+
baseURL: s.client.BaseURL.BucketURL,
2338+
uri: "/" + encodeURIComponent(name) + "?ci-process=AIImageColoring",
2339+
method: http.MethodGet,
2340+
optQuery: opt,
2341+
disableCloseBody: true,
2342+
}
2343+
resp, err := s.client.send(ctx, &sendOpt)
2344+
return resp, err
2345+
}
2346+
22992347
// GetAISuperResolution https://cloud.tencent.com/document/product/460/83793
23002348
func (s *CIService) GetAISuperResolution(ctx context.Context, name string) (*Response, error) {
23012349
sendOpt := sendOptions{
@@ -2308,6 +2356,24 @@ func (s *CIService) GetAISuperResolution(ctx context.Context, name string) (*Res
23082356
return resp, err
23092357
}
23102358

2359+
// AIImageColoringOptions TODO
2360+
type AISuperResolutionOptions struct {
2361+
DetectUrl string `url:"detect-url,omitempty"`
2362+
}
2363+
2364+
// GetAISuperResolution https://cloud.tencent.com/document/product/460/83793
2365+
func (s *CIService) GetAISuperResolutionV2(ctx context.Context, name string, opt *AISuperResolutionOptions) (*Response, error) {
2366+
sendOpt := sendOptions{
2367+
baseURL: s.client.BaseURL.BucketURL,
2368+
uri: "/" + encodeURIComponent(name) + "?ci-process=AISuperResolution",
2369+
method: http.MethodGet,
2370+
optQuery: opt,
2371+
disableCloseBody: true,
2372+
}
2373+
resp, err := s.client.send(ctx, &sendOpt)
2374+
return resp, err
2375+
}
2376+
23112377
// GetAIEnhanceImage https://cloud.tencent.com/document/product/460/83792
23122378
func (s *CIService) GetAIEnhanceImage(ctx context.Context, name string) (*Response, error) {
23132379
sendOpt := sendOptions{
@@ -2320,6 +2386,27 @@ func (s *CIService) GetAIEnhanceImage(ctx context.Context, name string) (*Respon
23202386
return resp, err
23212387
}
23222388

2389+
// AIEnhanceImageOptions 图像增强选项
2390+
type AIEnhanceImageOptions struct {
2391+
DetectUrl string `url:"detect-url,omitempty"`
2392+
Senoise int `url:"denoise,omitempty"`
2393+
Sharpen int `url:"sharpen,omitempty"`
2394+
IgnoreError int `url:"ignore-error,omitempty"`
2395+
}
2396+
2397+
// GetAIEnhanceImage https://cloud.tencent.com/document/product/460/83792
2398+
func (s *CIService) GetAIEnhanceImageV2(ctx context.Context, name string, opt *AIEnhanceImageOptions) (*Response, error) {
2399+
sendOpt := sendOptions{
2400+
baseURL: s.client.BaseURL.BucketURL,
2401+
uri: "/" + encodeURIComponent(name) + "?ci-process=AIEnhanceImage",
2402+
method: http.MethodGet,
2403+
optQuery: opt,
2404+
disableCloseBody: true,
2405+
}
2406+
resp, err := s.client.send(ctx, &sendOpt)
2407+
return resp, err
2408+
}
2409+
23232410
// AIImageCropOptions 图像智能裁剪选项
23242411
type AIImageCropOptions struct {
23252412
DetectUrl string `url:"detect-url,omitempty"`
@@ -2374,8 +2461,9 @@ func (s *CIService) GetAutoTranslationBlock(ctx context.Context, opt *AutoTransl
23742461

23752462
// ImageRepairOptions 图像修复选项
23762463
type ImageRepairOptions struct {
2377-
MaskPic string `url:"MaskPic,omitempty"`
2378-
MaskPoly string `url:"MaskPoly,omitempty"`
2464+
DetectUrl string `url:"detect-url,omitempty"`
2465+
MaskPic string `url:"MaskPic,omitempty"`
2466+
MaskPoly string `url:"MaskPoly,omitempty"`
23792467
}
23802468

23812469
// GetImageRepair https://cloud.tencent.com/document/product/460/79042
@@ -2462,3 +2550,30 @@ func (s *CIService) TDCRefresh(ctx context.Context, name string) (*Response, err
24622550
resp, err := s.client.send(ctx, &sendOpt)
24632551
return resp, err
24642552
}
2553+
2554+
type AIGameRecOptions struct {
2555+
DetectUrl string `url:"detect-url,omitempty"`
2556+
}
2557+
2558+
type AIGameRecResult struct {
2559+
XMLName xml.Name `xml:"RecognitionResult"`
2560+
GameLabels *struct {
2561+
Confidence int `xml:"Confidence,omitempty"`
2562+
FirstCategory string `xml:"FirstCategory,omitempty"`
2563+
SecondCategory string `xml:"SecondCategory,omitempty"`
2564+
GameName string `xml:"GameName,omitempty"`
2565+
} `xml:"GameLabels,omitempty"`
2566+
}
2567+
2568+
func (s *CIService) AIGameRec(ctx context.Context, obj string, opt *AIGameRecOptions) (*AIGameRecResult, *Response, error) {
2569+
var res AIGameRecResult
2570+
sendOpt := &sendOptions{
2571+
baseURL: s.client.BaseURL.BucketURL,
2572+
method: http.MethodGet,
2573+
uri: "/" + encodeURIComponent(obj) + "?ci-process=AIGameRec",
2574+
optQuery: opt,
2575+
result: &res,
2576+
}
2577+
resp, err := s.client.send(ctx, sendOpt)
2578+
return &res, resp, err
2579+
}

ci_media.go

Lines changed: 140 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,13 @@ type Subtitles struct {
448448

449449
// Subtitle TODO
450450
type Subtitle struct {
451-
Url []Subtitle `xml:"Url,omitempty"`
451+
Url string `xml:"Url,omitempty"`
452+
Embed string `xml:"Embed,omitempty"`
453+
FontType string `xml:"FontType,omitempty"`
454+
FontSize string `xml:"FontSize,omitempty"`
455+
FontColor string `xml:"FontColor,omitempty"`
456+
OutlineColor string `xml:"OutlineColor,omitempty"`
457+
VMargin string `xml:"VMargin,omitempty"`
452458
}
453459

454460
// VideoTag TODO
@@ -753,6 +759,9 @@ type MediaProcessJobOperation struct {
753759
VocalScoreResult *VocalScoreResult `xml:"VocalScoreResult,omitempty"`
754760
ImageInspect *ImageInspect `xml:"ImageInspect,omitempty"`
755761
ImageInspectResult *ImageInspectResult `xml:"ImageInspectResult,omitempty"`
762+
SnapshotPrefix string `xml:"SnapshotPrefix,omitempty"`
763+
ImageOCR *ImageOCRTemplate `xml:"ImageOCR,omitempty"`
764+
Detection *ImageOCRDetection `xml:"Detection,omitempty"`
756765
}
757766

758767
// CreatePicJobsOptions TODO
@@ -887,11 +896,12 @@ type WorkflowExecutionNotifyBody struct {
887896
ObjectCount int `xml:"ObjectCount"`
888897
SpriteObjectCount int `xml:"SpriteObjectCount"`
889898
ObjectInfo []struct {
890-
ObjectName string `xml:"ObjectName"`
891-
ObjectUrl string `xml:"ObjectUrl"`
892-
InputObjectName string `xml:"InputObjectName"`
893-
Code string `xml:"Code"`
894-
Message string `xml:"Message"`
899+
ObjectName string `xml:"ObjectName"`
900+
ObjectUrl string `xml:"ObjectUrl"`
901+
InputObjectName string `xml:"InputObjectName"`
902+
Code string `xml:"Code"`
903+
Message string `xml:"Message"`
904+
ImageOcrResult *ImageOCRDetection `xml:"ImageOcrResult,omitempty"`
895905
} `xml:"ObjectInfo,omitempty"`
896906
SpriteObjectInfo []struct {
897907
ObjectName string `xml:"ObjectName"`
@@ -1731,6 +1741,9 @@ type NodeOperation struct {
17311741
Condition *WorkflowNodeCondition `xml:"Condition,omitempty" json:"Condition,omitempty"`
17321742
SegmentVideoBody *SegmentVideoBody `xml:"SegmentVideoBody,omitempty" json:"SegmentVideoBody,omitempty"`
17331743
ImageInspect *ImageInspect `xml:"ImageInspect,omitempty" json:"ImageInspect,omitempty"`
1744+
TranscodeConfig *struct {
1745+
FreeTranscode string `xml:"FreeTranscode,omitempty" json:"FreeTranscode,omitempty"`
1746+
} `xml:"TranscodeConfig,omitempty" json:"TranscodeConfig,omitempty"`
17341747
}
17351748

17361749
// Node TODO
@@ -2327,6 +2340,7 @@ type Template struct {
23272340
NoiseReduction *NoiseReduction `xml:"NoiseReduction,omitempty" json:"NoiseReduction,omitempty"`
23282341
VideoEnhance *VideoEnhance `xml:"VideoEnhance,omitempty" json:"VideoEnhance,omitempty"`
23292342
VideoTargetRec *VideoTargetRec `xml:"VideoTargetRec,omitempty" json:"VideoTargetRec,omitempty"`
2343+
ImageOCR *ImageOCRTemplate `xml:"ImageOCR,omitempty" json:"ImageOCR,omitempty"`
23302344
}
23312345

23322346
// CreateMediaSnapshotTemplate 创建截图模板
@@ -3072,6 +3086,7 @@ type InventoryTriggerJobOperation struct {
30723086
Tag string `xml:"Tag,omitempty"`
30733087
JobParam *InventoryTriggerJobOperationJobParam `xml:"JobParam,omitempty"`
30743088
Output *JobOutput `xml:"Output,omitempty"`
3089+
FreeTranscode string `xml:"FreeTranscode,omitempty"`
30753090
}
30763091

30773092
// InventoryTriggerJobOperationJobParam TODO
@@ -3110,6 +3125,8 @@ type InventoryTriggerJobOperationJobParam struct {
31103125
VocalScoreResult *VocalScoreResult `xml:"VocalScoreResult,omitempty"`
31113126
ImageInspect *ImageInspect `xml:"ImageInspect,omitempty"`
31123127
ImageInspectResult *ImageInspectResult `xml:"ImageInspectResult,omitempty"`
3128+
ImageOCR *ImageOCRTemplate `xml:"ImageOCR,omitempty"`
3129+
Detection *ImageOCRDetection `xml:"Detection,omitempty"`
31133130
}
31143131

31153132
// InventoryTriggerJob TODO
@@ -3711,3 +3728,120 @@ func (s *CIService) CosImageInspect(ctx context.Context, name string, opt *CosIm
37113728
resp, err := s.client.send(ctx, &sendOpt)
37123729
return &res, resp, err
37133730
}
3731+
3732+
// CreateOCRTemplateOptions TODO
3733+
type CreateOCRTemplateOptions struct {
3734+
XMLName xml.Name `xml:"Request"`
3735+
Tag string `xml:"Tag,omitempty"`
3736+
Name string `xml:"Name,omitempty"`
3737+
ImageOCR *ImageOCRTemplate `xml:"ImageOCR,omitempty" json:"ImageOCR,omitempty"`
3738+
}
3739+
3740+
// ImageOCRTemplate TODO
3741+
type ImageOCRTemplate struct {
3742+
Type string `xml:"Type,omitempty"`
3743+
LanguageType string `xml:"LanguageType,omitempty"`
3744+
IsPdf string `xml:"IsPdf,omitempty"`
3745+
PdfPageNumber string `xml:"PdfPageNumber,omitempty"`
3746+
IsWord string `xml:"IsWord,omitempty"`
3747+
EnableWordPolygon string `xml:"EnableWordPolygon,omitempty"`
3748+
}
3749+
3750+
// CreateOCRTemplate 创建OCR模板
3751+
func (s *CIService) CreateOCRTemplate(ctx context.Context, opt *CreateOCRTemplateOptions) (*CreateMediaTemplateResult, *Response, error) {
3752+
var res CreateMediaTemplateResult
3753+
sendOpt := sendOptions{
3754+
baseURL: s.client.BaseURL.CIURL,
3755+
uri: "/template",
3756+
method: http.MethodPost,
3757+
body: opt,
3758+
result: &res,
3759+
}
3760+
resp, err := s.client.send(ctx, &sendOpt)
3761+
return &res, resp, err
3762+
}
3763+
3764+
// UpdateOCRTemplate 更新OCR模板
3765+
func (s *CIService) UpdateOCRTemplate(ctx context.Context, opt *CreateOCRTemplateOptions, templateId string) (*CreateMediaTemplateResult, *Response, error) {
3766+
var res CreateMediaTemplateResult
3767+
sendOpt := sendOptions{
3768+
baseURL: s.client.BaseURL.CIURL,
3769+
uri: "/template/" + templateId,
3770+
method: http.MethodPut,
3771+
body: opt,
3772+
result: &res,
3773+
}
3774+
resp, err := s.client.send(ctx, &sendOpt)
3775+
return &res, resp, err
3776+
}
3777+
3778+
// ImageOCRDetection TODO
3779+
type ImageOCRDetection struct {
3780+
InputObjectName string `xml:"InputObjectName,omitempty"`
3781+
InputObjectUrl string `xml:"InputObjectUrl,omitempty"`
3782+
ObjectName string `xml:"ObjectName,omitempty"`
3783+
ObjectUrl string `xml:"ObjectUrl,omitempty"`
3784+
Code string `xml:"Code,omitempty"`
3785+
State string `xml:"State,omitempty"`
3786+
Message string `xml:"Message,omitempty"`
3787+
TextDetections []ImageOCRTextDetections `xml:"TextDetections,omitempty"`
3788+
Language string `xml:"Language,omitempty"`
3789+
Angel string `xml:"Angel,omitempty"`
3790+
PdfPageSize int `xml:"PdfPageSize,omitempty"`
3791+
}
3792+
3793+
// ImageOCRTextDetections TODO
3794+
type ImageOCRTextDetections struct {
3795+
DetectedText string `xml:"DetectedText,omitempty"`
3796+
Confidence int `xml:"Confidence,omitempty"`
3797+
Polygon []ImageOCRTextPolygon `xml:"Polygon,omitempty"`
3798+
ItemPolygon []ImageOCRTextItemPolygon `xml:"ItemPolygon,omitempty"`
3799+
Words []ImageOCRTextWords `xml:"Words,omitempty"`
3800+
WordPolygon []ImageOCRTextWordPolygon `xml:"WordPolygon,omitempty"`
3801+
}
3802+
3803+
// ImageOCRTextPolygon TODO
3804+
type ImageOCRTextPolygon struct {
3805+
X int `xml:"X,omitempty"`
3806+
Y int `xml:"Y,omitempty"`
3807+
}
3808+
3809+
// ImageOCRTextItemPolygon TODO
3810+
type ImageOCRTextItemPolygon struct {
3811+
X int `xml:"X,omitempty"`
3812+
Y int `xml:"Y,omitempty"`
3813+
Width int `xml:"Width,omitempty"`
3814+
Height int `xml:"Height,omitempty"`
3815+
}
3816+
3817+
// ImageOCRTextWords TODO
3818+
type ImageOCRTextWords struct {
3819+
Confidence int `xml:"Confidence,omitempty"`
3820+
Character string `xml:"Character,omitempty"`
3821+
WordCoordPoint []struct {
3822+
WordCoordinate []struct {
3823+
X int `xml:"X,omitempty"`
3824+
Y int `xml:"Y,omitempty"`
3825+
} `xml:"WordCoordinate,omitempty"`
3826+
} `xml:"WordCoordPoint,omitempty"`
3827+
}
3828+
3829+
// ImageOCRTextWordPolygon TODO
3830+
type ImageOCRTextWordPolygon struct {
3831+
LeftTop []struct {
3832+
X int `xml:"X,omitempty"`
3833+
Y int `xml:"Y,omitempty"`
3834+
} `xml:"LeftTop,omitempty"`
3835+
RightTop []struct {
3836+
X int `xml:"X,omitempty"`
3837+
Y int `xml:"Y,omitempty"`
3838+
} `xml:"RightTop,omitempty"`
3839+
LeftBottom []struct {
3840+
X int `xml:"X,omitempty"`
3841+
Y int `xml:"Y,omitempty"`
3842+
} `xml:"LeftBottom,omitempty"`
3843+
RightBottom []struct {
3844+
X int `xml:"X,omitempty"`
3845+
Y int `xml:"Y,omitempty"`
3846+
} `xml:"RightBottom,omitempty"`
3847+
}

0 commit comments

Comments
 (0)