Release ColorizeImage.

This commit is contained in:
sdk-team
2020-12-02 02:39:42 +00:00
parent a5a458ce5d
commit d5ce9f9cf5
8 changed files with 246 additions and 0 deletions

View File

@@ -1,3 +1,6 @@
2020-12-02 Version: patch
- Release ColorizeImage.
2020-12-02 Version: patch
- Release MergeVideoFace EnhanceVideoQuality.

View File

@@ -29,6 +29,8 @@ set(imageenhan_public_header_model
include/alibabacloud/imageenhan/model/AssessSharpnessResult.h
include/alibabacloud/imageenhan/model/ChangeImageSizeRequest.h
include/alibabacloud/imageenhan/model/ChangeImageSizeResult.h
include/alibabacloud/imageenhan/model/ColorizeImageRequest.h
include/alibabacloud/imageenhan/model/ColorizeImageResult.h
include/alibabacloud/imageenhan/model/EnhanceImageColorRequest.h
include/alibabacloud/imageenhan/model/EnhanceImageColorResult.h
include/alibabacloud/imageenhan/model/ErasePersonRequest.h
@@ -68,6 +70,8 @@ set(imageenhan_src
src/model/AssessSharpnessResult.cc
src/model/ChangeImageSizeRequest.cc
src/model/ChangeImageSizeResult.cc
src/model/ColorizeImageRequest.cc
src/model/ColorizeImageResult.cc
src/model/EnhanceImageColorRequest.cc
src/model/EnhanceImageColorResult.cc
src/model/ErasePersonRequest.cc

View File

@@ -30,6 +30,8 @@
#include "model/AssessSharpnessResult.h"
#include "model/ChangeImageSizeRequest.h"
#include "model/ChangeImageSizeResult.h"
#include "model/ColorizeImageRequest.h"
#include "model/ColorizeImageResult.h"
#include "model/EnhanceImageColorRequest.h"
#include "model/EnhanceImageColorResult.h"
#include "model/ErasePersonRequest.h"
@@ -79,6 +81,9 @@ namespace AlibabaCloud
typedef Outcome<Error, Model::ChangeImageSizeResult> ChangeImageSizeOutcome;
typedef std::future<ChangeImageSizeOutcome> ChangeImageSizeOutcomeCallable;
typedef std::function<void(const ImageenhanClient*, const Model::ChangeImageSizeRequest&, const ChangeImageSizeOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ChangeImageSizeAsyncHandler;
typedef Outcome<Error, Model::ColorizeImageResult> ColorizeImageOutcome;
typedef std::future<ColorizeImageOutcome> ColorizeImageOutcomeCallable;
typedef std::function<void(const ImageenhanClient*, const Model::ColorizeImageRequest&, const ColorizeImageOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ColorizeImageAsyncHandler;
typedef Outcome<Error, Model::EnhanceImageColorResult> EnhanceImageColorOutcome;
typedef std::future<EnhanceImageColorOutcome> EnhanceImageColorOutcomeCallable;
typedef std::function<void(const ImageenhanClient*, const Model::EnhanceImageColorRequest&, const EnhanceImageColorOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> EnhanceImageColorAsyncHandler;
@@ -138,6 +143,9 @@ namespace AlibabaCloud
ChangeImageSizeOutcome changeImageSize(const Model::ChangeImageSizeRequest &request)const;
void changeImageSizeAsync(const Model::ChangeImageSizeRequest& request, const ChangeImageSizeAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
ChangeImageSizeOutcomeCallable changeImageSizeCallable(const Model::ChangeImageSizeRequest& request) const;
ColorizeImageOutcome colorizeImage(const Model::ColorizeImageRequest &request)const;
void colorizeImageAsync(const Model::ColorizeImageRequest& request, const ColorizeImageAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
ColorizeImageOutcomeCallable colorizeImageCallable(const Model::ColorizeImageRequest& request) const;
EnhanceImageColorOutcome enhanceImageColor(const Model::EnhanceImageColorRequest &request)const;
void enhanceImageColorAsync(const Model::EnhanceImageColorRequest& request, const EnhanceImageColorAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
EnhanceImageColorOutcomeCallable enhanceImageColorCallable(const Model::EnhanceImageColorRequest& request) const;

View File

@@ -0,0 +1,48 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ALIBABACLOUD_IMAGEENHAN_MODEL_COLORIZEIMAGEREQUEST_H_
#define ALIBABACLOUD_IMAGEENHAN_MODEL_COLORIZEIMAGEREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/imageenhan/ImageenhanExport.h>
namespace AlibabaCloud
{
namespace Imageenhan
{
namespace Model
{
class ALIBABACLOUD_IMAGEENHAN_EXPORT ColorizeImageRequest : public RpcServiceRequest
{
public:
ColorizeImageRequest();
~ColorizeImageRequest();
std::string getImageURL()const;
void setImageURL(const std::string& imageURL);
private:
std::string imageURL_;
};
}
}
}
#endif // !ALIBABACLOUD_IMAGEENHAN_MODEL_COLORIZEIMAGEREQUEST_H_

View File

@@ -0,0 +1,55 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ALIBABACLOUD_IMAGEENHAN_MODEL_COLORIZEIMAGERESULT_H_
#define ALIBABACLOUD_IMAGEENHAN_MODEL_COLORIZEIMAGERESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/imageenhan/ImageenhanExport.h>
namespace AlibabaCloud
{
namespace Imageenhan
{
namespace Model
{
class ALIBABACLOUD_IMAGEENHAN_EXPORT ColorizeImageResult : public ServiceResult
{
public:
struct Data
{
std::string imageURL;
};
ColorizeImageResult();
explicit ColorizeImageResult(const std::string &payload);
~ColorizeImageResult();
Data getData()const;
protected:
void parse(const std::string &payload);
private:
Data data_;
};
}
}
}
#endif // !ALIBABACLOUD_IMAGEENHAN_MODEL_COLORIZEIMAGERESULT_H_

View File

@@ -195,6 +195,42 @@ ImageenhanClient::ChangeImageSizeOutcomeCallable ImageenhanClient::changeImageSi
return task->get_future();
}
ImageenhanClient::ColorizeImageOutcome ImageenhanClient::colorizeImage(const ColorizeImageRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return ColorizeImageOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return ColorizeImageOutcome(ColorizeImageResult(outcome.result()));
else
return ColorizeImageOutcome(outcome.error());
}
void ImageenhanClient::colorizeImageAsync(const ColorizeImageRequest& request, const ColorizeImageAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, colorizeImage(request), context);
};
asyncExecute(new Runnable(fn));
}
ImageenhanClient::ColorizeImageOutcomeCallable ImageenhanClient::colorizeImageCallable(const ColorizeImageRequest &request) const
{
auto task = std::make_shared<std::packaged_task<ColorizeImageOutcome()>>(
[this, request]()
{
return this->colorizeImage(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ImageenhanClient::EnhanceImageColorOutcome ImageenhanClient::enhanceImageColor(const EnhanceImageColorRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -0,0 +1,40 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/imageenhan/model/ColorizeImageRequest.h>
using AlibabaCloud::Imageenhan::Model::ColorizeImageRequest;
ColorizeImageRequest::ColorizeImageRequest() :
RpcServiceRequest("imageenhan", "2019-09-30", "ColorizeImage")
{
setMethod(HttpRequest::Method::Post);
}
ColorizeImageRequest::~ColorizeImageRequest()
{}
std::string ColorizeImageRequest::getImageURL()const
{
return imageURL_;
}
void ColorizeImageRequest::setImageURL(const std::string& imageURL)
{
imageURL_ = imageURL;
setBodyParameter("ImageURL", imageURL);
}

View File

@@ -0,0 +1,52 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/imageenhan/model/ColorizeImageResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Imageenhan;
using namespace AlibabaCloud::Imageenhan::Model;
ColorizeImageResult::ColorizeImageResult() :
ServiceResult()
{}
ColorizeImageResult::ColorizeImageResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
ColorizeImageResult::~ColorizeImageResult()
{}
void ColorizeImageResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto dataNode = value["Data"];
if(!dataNode["ImageURL"].isNull())
data_.imageURL = dataNode["ImageURL"].asString();
}
ColorizeImageResult::Data ColorizeImageResult::getData()const
{
return data_;
}