美白 磨皮 work
This commit is contained in:
parent
6bd85ac487
commit
49e285db9c
|
@ -36,6 +36,11 @@ namespace Opipe {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AlphaBlendFilter::setInputFramebuffer(Framebuffer* framebuffer,
|
||||||
|
RotationMode rotationMode,
|
||||||
|
int texIdx, bool ignoreForPrepared) {
|
||||||
|
Filter::setInputFramebuffer(framebuffer, rotationMode, texIdx, ignoreForPrepared);
|
||||||
|
}
|
||||||
|
|
||||||
bool AlphaBlendFilter::proceed(float frameTime,
|
bool AlphaBlendFilter::proceed(float frameTime,
|
||||||
bool bUpdateTargets/* = true*/) {
|
bool bUpdateTargets/* = true*/) {
|
||||||
|
|
|
@ -21,6 +21,10 @@ namespace Opipe {
|
||||||
_mix = mix;
|
_mix = mix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setInputFramebuffer(Framebuffer* framebuffer,
|
||||||
|
RotationMode rotationMode,
|
||||||
|
int texIdx, bool ignoreForPrepared) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AlphaBlendFilter(Context *context);
|
AlphaBlendFilter(Context *context);
|
||||||
virtual ~AlphaBlendFilter() {};
|
virtual ~AlphaBlendFilter() {};
|
||||||
|
|
|
@ -142,7 +142,7 @@ namespace Opipe {
|
||||||
}
|
}
|
||||||
|
|
||||||
_lockKey = lockKey;
|
_lockKey = lockKey;
|
||||||
_framebufferRetainCount = 1;
|
_framebufferRetainCount++;
|
||||||
Log("Framebuffer LOCK", "lock retainCount == :%d lockKey:%s 【framebufferCode:%s】",
|
Log("Framebuffer LOCK", "lock retainCount == :%d lockKey:%s 【framebufferCode:%s】",
|
||||||
_framebufferRetainCount,
|
_framebufferRetainCount,
|
||||||
lockKey.c_str(), _hashCode.c_str());
|
lockKey.c_str(), _hashCode.c_str());
|
||||||
|
@ -169,7 +169,7 @@ namespace Opipe {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Framebuffer::resetRetainCount() {
|
void Framebuffer::resetRetainCount() {
|
||||||
_framebufferRetainCount = 1;
|
_framebufferRetainCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *Framebuffer::frameBufferGetBaseAddress() {
|
void *Framebuffer::frameBufferGetBaseAddress() {
|
||||||
|
@ -183,7 +183,7 @@ namespace Opipe {
|
||||||
return _width * 4;
|
return _width * 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#if defined(__ANDROID__) || defined(ANDROID)
|
//#if PLATFORM == PLATFORM_ANDROID
|
||||||
// AHardwareBuffer_Desc& Framebuffer::getAHardwareBufferDesc(){
|
// AHardwareBuffer_Desc& Framebuffer::getAHardwareBufferDesc(){
|
||||||
// return _graphicBufDes;
|
// return _graphicBufDes;
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -91,7 +91,6 @@ Framebuffer* FramebufferCache::fetchFramebuffer(Context *context,
|
||||||
Log("Framebuffer 【命中缓存】", "hashcode:%s count:%d",
|
Log("Framebuffer 【命中缓存】", "hashcode:%s count:%d",
|
||||||
framebufferHashCodeKey.first.c_str(),
|
framebufferHashCodeKey.first.c_str(),
|
||||||
framebuffer->framebufferRetainCount());
|
framebuffer->framebufferRetainCount());
|
||||||
framebuffer->resetRetainCount();
|
|
||||||
return framebuffer;
|
return framebuffer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,4 +74,61 @@ namespace Opipe
|
||||||
_filterProgram->setUniformValue("step", _step);
|
_filterProgram->setUniformValue("step", _step);
|
||||||
return Filter::proceed(frameTime, bUpdateTargets);
|
return Filter::proceed(frameTime, bUpdateTargets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LUTFilter::update(float frameTime) {
|
||||||
|
if (_inputFramebuffers.empty()) return;
|
||||||
|
|
||||||
|
if (!_enable) {
|
||||||
|
_framebuffer = _inputFramebuffers.begin()->second.frameBuffer;
|
||||||
|
Source::updateTargets(frameTime);
|
||||||
|
_framebuffer = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getContext()->isCapturingFrame && this == getContext()->captureUpToFilter) {
|
||||||
|
int captureWidth = getContext()->captureWidth;
|
||||||
|
int captureHeight = getContext()->captureHeight;
|
||||||
|
|
||||||
|
_framebuffer = getContext()->getFramebufferCache()->fetchFramebuffer(_context, captureWidth, captureHeight);
|
||||||
|
#if DEBUG
|
||||||
|
_framebuffer->lock(typeid(*this).name());
|
||||||
|
#else
|
||||||
|
_framebuffer->lock();
|
||||||
|
#endif
|
||||||
|
proceed(false);
|
||||||
|
|
||||||
|
_framebuffer->active();
|
||||||
|
getContext()->capturedFrameData = new unsigned char[captureWidth * captureHeight * 4];
|
||||||
|
CHECK_GL(glReadPixels(0, 0, captureWidth, captureHeight, GL_RGBA, GL_UNSIGNED_BYTE, getContext()->capturedFrameData));
|
||||||
|
_framebuffer->inactive();
|
||||||
|
#if DEBUG
|
||||||
|
_framebuffer->unlock(typeid(*this).name());
|
||||||
|
#else
|
||||||
|
_framebuffer->unlock();
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
// todo
|
||||||
|
Framebuffer* firstInputFramebuffer = _inputFramebuffers.begin()->second.frameBuffer;
|
||||||
|
RotationMode firstInputRotation = _inputFramebuffers.begin()->second.rotationMode;
|
||||||
|
if (!firstInputFramebuffer) return;
|
||||||
|
|
||||||
|
int rotatedFramebufferWidth = firstInputFramebuffer->getWidth();
|
||||||
|
int rotatedFramebufferHeight = firstInputFramebuffer->getHeight();
|
||||||
|
if (rotationSwapsSize(firstInputRotation))
|
||||||
|
{
|
||||||
|
rotatedFramebufferWidth = firstInputFramebuffer->getHeight();
|
||||||
|
rotatedFramebufferHeight = firstInputFramebuffer->getWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_framebufferScale != 1.0) {
|
||||||
|
rotatedFramebufferWidth = int(rotatedFramebufferWidth * _framebufferScale);
|
||||||
|
rotatedFramebufferHeight = int(rotatedFramebufferHeight * _framebufferScale);
|
||||||
|
}
|
||||||
|
|
||||||
|
_framebuffer = getContext()->getFramebufferCache()->fetchFramebuffer(_context, rotatedFramebufferWidth, rotatedFramebufferHeight);
|
||||||
|
proceed(frameTime);
|
||||||
|
}
|
||||||
|
// _context->getFramebufferCache()->returnFramebuffer(_framebuffer);
|
||||||
|
_framebuffer = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,15 @@ namespace Opipe
|
||||||
bool init(Context *context);
|
bool init(Context *context);
|
||||||
void setStep(float step);
|
void setStep(float step);
|
||||||
virtual bool proceed(float frameTime = 0, bool bUpdateTargets = true) override;
|
virtual bool proceed(float frameTime = 0, bool bUpdateTargets = true) override;
|
||||||
|
virtual void update(float frameTime) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LUTFilter(Context *context);
|
LUTFilter(Context *context);
|
||||||
~LUTFilter(){};
|
~LUTFilter()
|
||||||
|
{
|
||||||
|
delete _framebuffer;
|
||||||
|
_framebuffer = nullptr;
|
||||||
|
};
|
||||||
float _step;
|
float _step;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -100,33 +100,21 @@ namespace Opipe {
|
||||||
|
|
||||||
if (_framebuffer != nullptr && (_framebuffer->getWidth() != rotatedFramebufferWidth ||
|
if (_framebuffer != nullptr && (_framebuffer->getWidth() != rotatedFramebufferWidth ||
|
||||||
_framebuffer->getHeight() != rotatedFramebufferHeight)) {
|
_framebuffer->getHeight() != rotatedFramebufferHeight)) {
|
||||||
_framebuffer = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_framebuffer == nullptr || (_framebuffer && _framebuffer->getTexture() != targetTextureId)) {
|
|
||||||
if (_framebuffer) {
|
|
||||||
delete _framebuffer;
|
|
||||||
_framebuffer = 0;
|
_framebuffer = 0;
|
||||||
}
|
}
|
||||||
if (targetTextureId == -1) {
|
|
||||||
|
if (_framebuffer == nullptr || _framebuffer->isDealloc) {
|
||||||
_framebuffer = getContext()->getFramebufferCache()->
|
_framebuffer = getContext()->getFramebufferCache()->
|
||||||
fetchFramebuffer(_context,
|
fetchFramebuffer(_context,
|
||||||
rotatedFramebufferWidth,
|
|
||||||
rotatedFramebufferHeight);
|
|
||||||
_framebuffer->lock();
|
|
||||||
targetTextureId = _framebuffer->getTexture();
|
|
||||||
} else {
|
|
||||||
_framebuffer = getContext()->getFramebufferCache()->
|
|
||||||
fetchFramebufferUseTextureId(_context,
|
|
||||||
rotatedFramebufferWidth,
|
rotatedFramebufferWidth,
|
||||||
rotatedFramebufferHeight,
|
rotatedFramebufferHeight,
|
||||||
targetTextureId,
|
|
||||||
false,
|
false,
|
||||||
targetTextureAttr);
|
targetTextureAttr);
|
||||||
_framebuffer->lock();
|
_framebuffer->lock();
|
||||||
_targetFramebuffer = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_framebuffer) {
|
||||||
|
targetTextureId = _framebuffer->getTexture();
|
||||||
}
|
}
|
||||||
|
|
||||||
proceed(frameTime);
|
proceed(frameTime);
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace Opipe {
|
||||||
public:
|
public:
|
||||||
void runSync(std::function<void(void)> func, Context::ContextType type = Context::GPUImageContext);
|
void runSync(std::function<void(void)> func, Context::ContextType type = Context::GPUImageContext);
|
||||||
void runAsync(std::function<void(void)> func, Context::ContextType type = Context::GPUImageContext,
|
void runAsync(std::function<void(void)> func, Context::ContextType type = Context::GPUImageContext,
|
||||||
bool async = false);
|
bool async = true);
|
||||||
|
|
||||||
void setGLThreadDispatch(GLThreadDispatch *glDispatch){
|
void setGLThreadDispatch(GLThreadDispatch *glDispatch){
|
||||||
_glThreadDispatch = glDispatch;
|
_glThreadDispatch = glDispatch;
|
||||||
|
|
|
@ -29,11 +29,7 @@ namespace Opipe
|
||||||
|
|
||||||
FaceMeshBeautyRender::~FaceMeshBeautyRender()
|
FaceMeshBeautyRender::~FaceMeshBeautyRender()
|
||||||
{
|
{
|
||||||
if (_lutImage)
|
|
||||||
{
|
|
||||||
_lutImage->release();
|
|
||||||
_lutImage = nullptr;
|
|
||||||
}
|
|
||||||
_olaBeautyFilter->removeAllTargets();
|
_olaBeautyFilter->removeAllTargets();
|
||||||
if (_olaBeautyFilter)
|
if (_olaBeautyFilter)
|
||||||
{
|
{
|
||||||
|
@ -46,22 +42,38 @@ namespace Opipe
|
||||||
_outputFilter->release();
|
_outputFilter->release();
|
||||||
_outputFilter = nullptr;
|
_outputFilter = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_lutImage)
|
||||||
|
{
|
||||||
|
auto *framebuffer = _lutImage->getFramebuffer();
|
||||||
|
delete framebuffer;
|
||||||
|
_lutImage->release();
|
||||||
|
_lutImage = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_inputFramebuffer) {
|
||||||
|
delete _inputFramebuffer;
|
||||||
|
_inputFramebuffer = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
_context->getFramebufferCache()->purge();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FaceMeshBeautyRender::suspend()
|
void FaceMeshBeautyRender::suspend()
|
||||||
{
|
{
|
||||||
_isRendering = true;
|
_isRendering = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FaceMeshBeautyRender::resume()
|
void FaceMeshBeautyRender::resume()
|
||||||
{
|
{
|
||||||
_isRendering = false;
|
_isRendering = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureInfo FaceMeshBeautyRender::renderTexture(TextureInfo inputTexture)
|
void FaceMeshBeautyRender::renderTexture(TextureInfo inputTexture)
|
||||||
{
|
{
|
||||||
TextureInfo outputTexture;
|
if (!_isRendering) {
|
||||||
outputTexture.frameTime = inputTexture.frameTime;
|
return;
|
||||||
|
}
|
||||||
if (!_inputFramebuffer)
|
if (!_inputFramebuffer)
|
||||||
{
|
{
|
||||||
_inputFramebuffer = new Framebuffer(_context, inputTexture.width, inputTexture.height,
|
_inputFramebuffer = new Framebuffer(_context, inputTexture.width, inputTexture.height,
|
||||||
|
@ -77,10 +89,20 @@ namespace Opipe
|
||||||
Framebuffer::defaultTextureAttribures,
|
Framebuffer::defaultTextureAttribures,
|
||||||
inputTexture.textureId);
|
inputTexture.textureId);
|
||||||
}
|
}
|
||||||
|
_inputFramebuffer->lock();
|
||||||
_olaBeautyFilter->setInputFramebuffer(_inputFramebuffer);
|
_olaBeautyFilter->setInputFramebuffer(_inputFramebuffer, NoRotation, 0, true);
|
||||||
_olaBeautyFilter->update(inputTexture.frameTime);
|
_olaBeautyFilter->update(inputTexture.frameTime);
|
||||||
|
_inputFramebuffer->unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
TextureInfo FaceMeshBeautyRender::outputRenderTexture(TextureInfo inputTexture)
|
||||||
|
{
|
||||||
|
if (_outputFilter == nullptr) {
|
||||||
|
return inputTexture;
|
||||||
|
}
|
||||||
|
|
||||||
|
TextureInfo outputTexture;
|
||||||
|
outputTexture.frameTime = inputTexture.frameTime;
|
||||||
auto *outputFramebuffer = _outputFilter->getFramebuffer();
|
auto *outputFramebuffer = _outputFilter->getFramebuffer();
|
||||||
if (outputFramebuffer) {
|
if (outputFramebuffer) {
|
||||||
outputTexture.width = outputFramebuffer->getWidth();
|
outputTexture.width = outputFramebuffer->getWidth();
|
||||||
|
@ -97,8 +119,6 @@ namespace Opipe
|
||||||
outputTexture.textureId = inputTexture.textureId;
|
outputTexture.textureId = inputTexture.textureId;
|
||||||
outputTexture.ioSurfaceId = inputTexture.ioSurfaceId;
|
outputTexture.ioSurfaceId = inputTexture.ioSurfaceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return outputTexture;
|
return outputTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,9 @@ namespace Opipe {
|
||||||
|
|
||||||
void resume();
|
void resume();
|
||||||
|
|
||||||
TextureInfo renderTexture(TextureInfo inputTexture);
|
void renderTexture(TextureInfo inputTexture);
|
||||||
|
|
||||||
|
TextureInfo outputRenderTexture(TextureInfo inputTexture);
|
||||||
|
|
||||||
/// 磨皮
|
/// 磨皮
|
||||||
float getSmoothing();
|
float getSmoothing();
|
||||||
|
|
|
@ -110,8 +110,25 @@ namespace Opipe
|
||||||
|
|
||||||
virtual void stopModule() = 0;
|
virtual void stopModule() = 0;
|
||||||
|
|
||||||
|
/// 磨皮
|
||||||
|
virtual float getSmoothing() = 0;
|
||||||
|
|
||||||
|
/// 美白
|
||||||
|
virtual float getWhitening() = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/// 磨皮
|
||||||
|
/// @param smoothing 磨皮 0.0 - 1.0
|
||||||
|
virtual void setSmoothing(float smoothing) = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/// 美白
|
||||||
|
/// @param whitening 美白 0.0 - 1.0
|
||||||
|
virtual void setWhitening(float whitening) = 0;
|
||||||
|
|
||||||
virtual TextureInfo renderTexture(TextureInfo inputTexture) = 0;
|
virtual TextureInfo renderTexture(TextureInfo inputTexture) = 0;
|
||||||
|
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
virtual void processVideoFrame(CVPixelBufferRef pixelbuffer, int64_t timeStamp) = 0;
|
virtual void processVideoFrame(CVPixelBufferRef pixelbuffer, int64_t timeStamp) = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "face_mesh_module_imp.h"
|
#include "face_mesh_module_imp.h"
|
||||||
|
#include "mediapipe/render/core/Context.hpp"
|
||||||
|
|
||||||
static const char* kNumFacesInputSidePacket = "num_faces";
|
static const char* kNumFacesInputSidePacket = "num_faces";
|
||||||
static const char* kLandmarksOutputStream = "multi_face_landmarks";
|
static const char* kLandmarksOutputStream = "multi_face_landmarks";
|
||||||
|
@ -113,7 +114,7 @@ namespace Opipe
|
||||||
_render = nullptr;
|
_render = nullptr;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
delete _context;
|
||||||
_context = nullptr;
|
_context = nullptr;
|
||||||
|
|
||||||
|
|
||||||
|
@ -121,13 +122,17 @@ namespace Opipe
|
||||||
|
|
||||||
void FaceMeshModuleIMP::suspend()
|
void FaceMeshModuleIMP::suspend()
|
||||||
{
|
{
|
||||||
|
if (_render) {
|
||||||
_render->suspend();
|
_render->suspend();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void FaceMeshModuleIMP::resume()
|
void FaceMeshModuleIMP::resume()
|
||||||
{
|
{
|
||||||
|
if (_render) {
|
||||||
_render->resume();
|
_render->resume();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool FaceMeshModuleIMP::init(void *env, void *binaryData,
|
bool FaceMeshModuleIMP::init(void *env, void *binaryData,
|
||||||
int size)
|
int size)
|
||||||
|
@ -139,12 +144,11 @@ namespace Opipe
|
||||||
config.ParseFromArray(binaryData, size);
|
config.ParseFromArray(binaryData, size);
|
||||||
_olaContext = new OlaContext();
|
_olaContext = new OlaContext();
|
||||||
_context = _olaContext->glContext();
|
_context = _olaContext->glContext();
|
||||||
_render = new FaceMeshBeautyRender(_context);
|
|
||||||
|
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__)
|
||||||
_context->initEGLContext(env);
|
_context->initEGLContext(env);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
_dispatch = std::make_unique<OpipeDispatch>(_context, nullptr, nullptr);
|
_dispatch = std::make_unique<OpipeDispatch>(_context, nullptr, nullptr);
|
||||||
|
|
||||||
_graph = std::make_unique<OlaGraph>(config);
|
_graph = std::make_unique<OlaGraph>(config);
|
||||||
|
@ -155,6 +159,13 @@ namespace Opipe
|
||||||
_graph->addFrameOutputStream(kOutputVideo, MPPPacketTypePixelBuffer);
|
_graph->addFrameOutputStream(kOutputVideo, MPPPacketTypePixelBuffer);
|
||||||
#endif
|
#endif
|
||||||
_isInit = true;
|
_isInit = true;
|
||||||
|
if (_render == nullptr) {
|
||||||
|
_dispatch->runSync([&] {
|
||||||
|
if (_render == nullptr) {
|
||||||
|
_render = new FaceMeshBeautyRender(_context);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -162,17 +173,17 @@ namespace Opipe
|
||||||
void FaceMeshModuleIMP::setLandmark(NormalizedLandmarkList landmark)
|
void FaceMeshModuleIMP::setLandmark(NormalizedLandmarkList landmark)
|
||||||
{
|
{
|
||||||
_lastLandmark = std::move(landmark);
|
_lastLandmark = std::move(landmark);
|
||||||
if (_lastLandmark.landmark_size() == 0) {
|
// if (_lastLandmark.landmark_size() == 0) {
|
||||||
#if defined(__APPLE__)
|
//#if defined(__APPLE__)
|
||||||
NSLog(@"没有人脸");
|
// NSLog(@"没有人脸");
|
||||||
#endif
|
//#endif
|
||||||
}
|
// }
|
||||||
for (int i = 0; i < _lastLandmark.landmark_size(); ++i) {
|
// for (int i = 0; i < _lastLandmark.landmark_size(); ++i) {
|
||||||
#if defined(__APPLE__)
|
//#if defined(__APPLE__)
|
||||||
NSLog(@"######## Set Landmark[%d]: (%f, %f, %f)", i, _lastLandmark.landmark(i).x(),
|
// NSLog(@"######## Set Landmark[%d]: (%f, %f, %f)", i, _lastLandmark.landmark(i).x(),
|
||||||
_lastLandmark.landmark(i).y(), _lastLandmark.landmark(i).z());
|
// _lastLandmark.landmark(i).y(), _lastLandmark.landmark(i).z());
|
||||||
#endif
|
//#endif
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void FaceMeshModuleIMP::startModule()
|
void FaceMeshModuleIMP::startModule()
|
||||||
|
@ -233,16 +244,29 @@ namespace Opipe
|
||||||
{
|
{
|
||||||
return textureInfo;
|
return textureInfo;
|
||||||
}
|
}
|
||||||
|
if (_render == nullptr) {
|
||||||
|
_dispatch->runSync([&] {
|
||||||
|
if (_render == nullptr) {
|
||||||
|
_render = new FaceMeshBeautyRender(_context);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
_dispatch->runSync([&] {
|
_dispatch->runSync([&] {
|
||||||
textureInfo = _render->renderTexture(inputTexture);
|
// GLsync sync;
|
||||||
|
// _dispatch->runAsync([&] {
|
||||||
|
// _render->renderTexture(inputTexture);
|
||||||
|
// sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||||
|
// glFlush();
|
||||||
|
// });
|
||||||
|
// glWaitSync(sync, 0, GL_TIMEOUT_IGNORED);
|
||||||
|
// glDeleteSync(sync);
|
||||||
|
_render->renderTexture(inputTexture);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
textureInfo = _render->outputRenderTexture(inputTexture);
|
||||||
return textureInfo;
|
return textureInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
// OlaContext* currentContext() {
|
|
||||||
// return _olaContext;
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,30 @@ namespace Opipe
|
||||||
|
|
||||||
virtual void setLandmark(NormalizedLandmarkList landmark);
|
virtual void setLandmark(NormalizedLandmarkList landmark);
|
||||||
|
|
||||||
|
/// 磨皮
|
||||||
|
float getSmoothing() override {
|
||||||
|
return _render->getSmoothing();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 美白
|
||||||
|
float getWhitening() override {
|
||||||
|
return _render->getWhitening();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// 磨皮
|
||||||
|
/// @param smoothing 磨皮 0.0 - 1.0
|
||||||
|
void setSmoothing(float smoothing) {
|
||||||
|
_render->setSmoothing(smoothing);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// 美白
|
||||||
|
/// @param whitening 美白 0.0 - 1.0
|
||||||
|
void setWhitening(float whitening) {
|
||||||
|
_render->setWhitening(whitening);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<OpipeDispatch> _dispatch;
|
std::unique_ptr<OpipeDispatch> _dispatch;
|
||||||
std::unique_ptr<OlaGraph> _graph;
|
std::unique_ptr<OlaGraph> _graph;
|
||||||
|
|
|
@ -79,6 +79,7 @@ namespace Opipe
|
||||||
if (factor7 < 0.999)
|
if (factor7 < 0.999)
|
||||||
{
|
{
|
||||||
lowp vec3 mix116Color = mix(inputColor.rgb, mix115Color.rgb, factor7);
|
lowp vec3 mix116Color = mix(inputColor.rgb, mix115Color.rgb, factor7);
|
||||||
|
// lowp vec3 mix116Color = vec3(1.0);
|
||||||
mix12Color = mix(mix116Color.rgb, blurColor.rgb, opacityLimit);
|
mix12Color = mix(mix116Color.rgb, blurColor.rgb, opacityLimit);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -64,48 +64,80 @@ namespace Opipe {
|
||||||
if (!FilterGroup::init(context)) {
|
if (!FilterGroup::init(context)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
_lutFilter = LUTFilter::create(context);
|
||||||
_bilateralFilter = BilateralFilter::create(context);
|
_unSharpMaskFilter = UnSharpMaskFilter::create(context);
|
||||||
addFilter(_bilateralFilter);
|
_unSharpMaskFilter->addTarget(_lutFilter, 0);
|
||||||
|
|
||||||
_bilateralAdjustFilter = BilateralAdjustFilter::create(context);
|
_bilateralAdjustFilter = BilateralAdjustFilter::create(context);
|
||||||
addFilter(_bilateralAdjustFilter);
|
addFilter(_bilateralAdjustFilter);
|
||||||
|
|
||||||
_unSharpMaskFilter = UnSharpMaskFilter::create(context);
|
|
||||||
addFilter(_unSharpMaskFilter);
|
|
||||||
|
|
||||||
_lutFilter = LUTFilter::create(context);
|
|
||||||
_unSharpMaskFilter->addTarget(_lutFilter, 0);
|
|
||||||
|
|
||||||
_lookUpGroupFilter = FilterGroup::create(context);
|
_lookUpGroupFilter = FilterGroup::create(context);
|
||||||
_lookUpGroupFilter->addFilter(_unSharpMaskFilter);
|
_lookUpGroupFilter->addFilter(_unSharpMaskFilter);
|
||||||
|
|
||||||
_alphaBlendFilter = AlphaBlendFilter::create(context);
|
_alphaBlendFilter = AlphaBlendFilter::create(context);
|
||||||
_faceDistortFilter = FaceDistortionFilter::create(context);
|
// addFilter(_lookUpGroupFilter);
|
||||||
|
// addFilter(_lutFilter);
|
||||||
|
|
||||||
|
|
||||||
_bilateralFilter->addTarget(_bilateralAdjustFilter, 1)->
|
// setTerminalFilter(_lutFilter);
|
||||||
addTarget(_alphaBlendFilter, 0);
|
|
||||||
|
|
||||||
_bilateralAdjustFilter->addTarget(_lookUpGroupFilter)->
|
_bilateralFilter = BilateralFilter::create(context);
|
||||||
addTarget(_alphaBlendFilter, 1)->addTarget(_faceDistortFilter);
|
addFilter(_bilateralFilter);
|
||||||
|
|
||||||
|
_bilateralAdjustFilter->addTarget(_lookUpGroupFilter)->addTarget(_alphaBlendFilter, 1);
|
||||||
|
|
||||||
|
_bilateralFilter->addTarget(_bilateralAdjustFilter, 1)->addTarget(_alphaBlendFilter, 0);
|
||||||
|
|
||||||
_alphaBlendFilter->setMix(0.0);
|
_alphaBlendFilter->setMix(0.0);
|
||||||
|
|
||||||
|
setTerminalFilter(_alphaBlendFilter);
|
||||||
|
|
||||||
|
_bilateralAdjustFilter->setOpacityLimit(0.6);
|
||||||
|
_bilateralFilter->setDistanceNormalizationFactor(2.746);
|
||||||
|
_bilateralFilter->setTexelSpacingMultiplier(2.7);
|
||||||
_unSharpMaskFilter->setBlurRadiusInPixel(4.0f, true);
|
_unSharpMaskFilter->setBlurRadiusInPixel(4.0f, true);
|
||||||
_unSharpMaskFilter->setBlurRadiusInPixel(2.0f, false);
|
_unSharpMaskFilter->setBlurRadiusInPixel(2.0f, false);
|
||||||
_unSharpMaskFilter->setIntensity(1.365);
|
_unSharpMaskFilter->setIntensity(1.365);
|
||||||
|
|
||||||
_bilateralAdjustFilter->setOpacityLimit(0.6);
|
// _bilateralFilter = BilateralFilter::create(context);
|
||||||
|
// addFilter(_bilateralFilter);
|
||||||
_bilateralFilter->setDistanceNormalizationFactor(2.746);
|
//
|
||||||
_bilateralFilter->setTexelSpacingMultiplier(2.7);
|
// _bilateralAdjustFilter = BilateralAdjustFilter::create(context);
|
||||||
|
// addFilter(_bilateralAdjustFilter);
|
||||||
setTerminalFilter(_faceDistortFilter);
|
//
|
||||||
|
// _unSharpMaskFilter = UnSharpMaskFilter::create(context);
|
||||||
|
//
|
||||||
|
// _lutFilter = LUTFilter::create(context);
|
||||||
|
// _unSharpMaskFilter->addTarget(_lutFilter, 0);
|
||||||
|
//
|
||||||
|
// _lookUpGroupFilter = FilterGroup::create(context);
|
||||||
|
// _lookUpGroupFilter->addFilter(_unSharpMaskFilter);
|
||||||
|
//
|
||||||
|
// _alphaBlendFilter = AlphaBlendFilter::create(context);
|
||||||
|
// _faceDistortFilter = FaceDistortionFilter::create(context);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// _bilateralFilter->addTarget(_bilateralAdjustFilter, 1)->
|
||||||
|
// addTarget(_alphaBlendFilter, 0);
|
||||||
|
//
|
||||||
|
// _bilateralAdjustFilter->addTarget(_lookUpGroupFilter)->
|
||||||
|
// addTarget(_alphaBlendFilter, 1)->addTarget(_faceDistortFilter);
|
||||||
|
//
|
||||||
|
// _alphaBlendFilter->setMix(0.8);
|
||||||
|
//
|
||||||
|
// _unSharpMaskFilter->setBlurRadiusInPixel(4.0f, true);
|
||||||
|
// _unSharpMaskFilter->setBlurRadiusInPixel(2.0f, false);
|
||||||
|
// _unSharpMaskFilter->setIntensity(1.365);
|
||||||
|
//
|
||||||
|
// _bilateralAdjustFilter->setOpacityLimit(0.6);
|
||||||
|
//
|
||||||
|
// _bilateralFilter->setDistanceNormalizationFactor(2.746);
|
||||||
|
// _bilateralFilter->setTexelSpacingMultiplier(2.7);
|
||||||
|
//
|
||||||
|
// setTerminalFilter(_faceDistortFilter);
|
||||||
|
|
||||||
std::vector<Vec2> defaultFace;
|
std::vector<Vec2> defaultFace;
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -120,11 +152,10 @@ namespace Opipe {
|
||||||
|
|
||||||
void OlaBeautyFilter::setLUTImage(SourceImage *lutImage) {
|
void OlaBeautyFilter::setLUTImage(SourceImage *lutImage) {
|
||||||
_lutImage = lutImage;
|
_lutImage = lutImage;
|
||||||
if (_lutFilter) {
|
|
||||||
auto *framebuffer = _lutFilter->getFramebuffer();
|
|
||||||
framebuffer->resetRetainCount();
|
|
||||||
_lutImage->retain();
|
_lutImage->retain();
|
||||||
_lutImage->addTarget(_lutFilter, 1, true);
|
if (_lutFilter) {
|
||||||
|
auto *framebuffer = lutImage->getFramebuffer();
|
||||||
|
_lutFilter->setInputFramebuffer(framebuffer, NoRotation, 1, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,21 +170,38 @@ namespace Opipe {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OlaBeautyFilter::setSmoothing(float smoothing) {
|
void OlaBeautyFilter::setSmoothing(float smoothing) {
|
||||||
smoothing = smoothing < -1 ? -1 : smoothing;
|
if (_bilateralAdjustFilter == nullptr) {
|
||||||
smoothing = smoothing > 1 ? 1 : smoothing;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (smoothing == 0.0) {
|
||||||
|
_bilateralAdjustFilter->setEnable(false);
|
||||||
|
} else {
|
||||||
|
_bilateralAdjustFilter->setEnable(true);
|
||||||
_bilateralAdjustFilter->setOpacityLimit(smoothing);
|
_bilateralAdjustFilter->setOpacityLimit(smoothing);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
float OlaBeautyFilter::getSmoothing() {
|
float OlaBeautyFilter::getSmoothing() {
|
||||||
|
if (_bilateralAdjustFilter) {
|
||||||
return _bilateralAdjustFilter->getOpacityLimit();
|
return _bilateralAdjustFilter->getOpacityLimit();
|
||||||
}
|
}
|
||||||
|
return 0.0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void OlaBeautyFilter::setWhitening(float whitening) {
|
void OlaBeautyFilter::setWhitening(float whitening) {
|
||||||
|
if (_alphaBlendFilter) {
|
||||||
_alphaBlendFilter->setMix(whitening);
|
_alphaBlendFilter->setMix(whitening);
|
||||||
}
|
}
|
||||||
|
_lutFilter->setStep(whitening);
|
||||||
|
}
|
||||||
|
|
||||||
float OlaBeautyFilter::getWhitening() {
|
float OlaBeautyFilter::getWhitening() {
|
||||||
|
if (_alphaBlendFilter) {
|
||||||
return _alphaBlendFilter->getMix();
|
return _alphaBlendFilter->getMix();
|
||||||
}
|
}
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ namespace Opipe {
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnSharpMaskFilter::setIntensity(float intensity) {
|
void UnSharpMaskFilter::setIntensity(float intensity) {
|
||||||
((UnSharpMaskFilter *)_unsharpMaskFilter)->setIntensity(intensity);
|
((UnSharpFilter *)_unsharpMaskFilter)->setIntensity(intensity);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnSharpMaskFilter::setBlurRadiusInPixel(float blurRadius,
|
void UnSharpMaskFilter::setBlurRadiusInPixel(float blurRadius,
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,79 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Scheme
|
||||||
|
LastUpgradeVersion = "1340"
|
||||||
|
version = "1.3">
|
||||||
|
<BuildAction
|
||||||
|
parallelizeBuildables = "YES"
|
||||||
|
buildImplicitDependencies = "YES">
|
||||||
|
<BuildActionEntries>
|
||||||
|
<BuildActionEntry
|
||||||
|
buildForTesting = "YES"
|
||||||
|
buildForRunning = "YES"
|
||||||
|
buildForProfiling = "YES"
|
||||||
|
buildForArchiving = "YES"
|
||||||
|
buildForAnalyzing = "YES">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "36B23935288934B100A41D9E"
|
||||||
|
BuildableName = "OpipeBeautyModuleExample.app"
|
||||||
|
BlueprintName = "OpipeBeautyModuleExample"
|
||||||
|
ReferencedContainer = "container:OpipeBeautyModuleExample.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildActionEntry>
|
||||||
|
</BuildActionEntries>
|
||||||
|
</BuildAction>
|
||||||
|
<TestAction
|
||||||
|
buildConfiguration = "Debug"
|
||||||
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
|
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||||
|
<Testables>
|
||||||
|
</Testables>
|
||||||
|
</TestAction>
|
||||||
|
<LaunchAction
|
||||||
|
buildConfiguration = "Debug"
|
||||||
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
|
launchStyle = "0"
|
||||||
|
useCustomWorkingDirectory = "NO"
|
||||||
|
ignoresPersistentStateOnLaunch = "NO"
|
||||||
|
debugDocumentVersioning = "YES"
|
||||||
|
debugServiceExtension = "internal"
|
||||||
|
enableGPUFrameCaptureMode = "1"
|
||||||
|
allowLocationSimulation = "YES">
|
||||||
|
<BuildableProductRunnable
|
||||||
|
runnableDebuggingMode = "0">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "36B23935288934B100A41D9E"
|
||||||
|
BuildableName = "OpipeBeautyModuleExample.app"
|
||||||
|
BlueprintName = "OpipeBeautyModuleExample"
|
||||||
|
ReferencedContainer = "container:OpipeBeautyModuleExample.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildableProductRunnable>
|
||||||
|
</LaunchAction>
|
||||||
|
<ProfileAction
|
||||||
|
buildConfiguration = "Release"
|
||||||
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
|
savedToolIdentifier = ""
|
||||||
|
useCustomWorkingDirectory = "NO"
|
||||||
|
debugDocumentVersioning = "YES">
|
||||||
|
<BuildableProductRunnable
|
||||||
|
runnableDebuggingMode = "0">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "36B23935288934B100A41D9E"
|
||||||
|
BuildableName = "OpipeBeautyModuleExample.app"
|
||||||
|
BlueprintName = "OpipeBeautyModuleExample"
|
||||||
|
ReferencedContainer = "container:OpipeBeautyModuleExample.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildableProductRunnable>
|
||||||
|
</ProfileAction>
|
||||||
|
<AnalyzeAction
|
||||||
|
buildConfiguration = "Debug">
|
||||||
|
</AnalyzeAction>
|
||||||
|
<ArchiveAction
|
||||||
|
buildConfiguration = "Release"
|
||||||
|
revealArchiveInOrganizer = "YES">
|
||||||
|
</ArchiveAction>
|
||||||
|
</Scheme>
|
|
@ -10,5 +10,13 @@
|
||||||
<integer>7</integer>
|
<integer>7</integer>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
|
<key>SuppressBuildableAutocreation</key>
|
||||||
|
<dict>
|
||||||
|
<key>36B23935288934B100A41D9E</key>
|
||||||
|
<dict>
|
||||||
|
<key>primary</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
|
@ -16,14 +16,29 @@
|
||||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
|
<subviews>
|
||||||
|
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.5" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="vhS-oS-Fej">
|
||||||
|
<rect key="frame" x="55" y="632" width="304" height="31"/>
|
||||||
|
<constraints>
|
||||||
|
<constraint firstAttribute="width" constant="300" id="YLm-AJ-oyY"/>
|
||||||
|
</constraints>
|
||||||
|
<connections>
|
||||||
|
<action selector="beautyChanged:" destination="BYZ-38-t0r" eventType="valueChanged" id="j3u-PR-SZh"/>
|
||||||
|
</connections>
|
||||||
|
</slider>
|
||||||
|
</subviews>
|
||||||
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
||||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||||
|
<constraints>
|
||||||
|
<constraint firstItem="vhS-oS-Fej" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="JJ0-gj-buS"/>
|
||||||
|
<constraint firstItem="6Tk-OE-BBY" firstAttribute="bottom" secondItem="vhS-oS-Fej" secondAttribute="bottom" constant="200" id="cTV-Ue-aqY"/>
|
||||||
|
</constraints>
|
||||||
</view>
|
</view>
|
||||||
<navigationItem key="navigationItem" id="95p-Qv-uS6"/>
|
<navigationItem key="navigationItem" id="95p-Qv-uS6"/>
|
||||||
</viewController>
|
</viewController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="30" y="84"/>
|
<point key="canvasLocation" x="28.985507246376812" y="83.705357142857139"/>
|
||||||
</scene>
|
</scene>
|
||||||
<!--Navigation Controller-->
|
<!--Navigation Controller-->
|
||||||
<scene sceneID="PGT-KT-KdN">
|
<scene sceneID="PGT-KT-KdN">
|
||||||
|
|
|
@ -50,6 +50,10 @@ AVCaptureAudioDataOutputSampleBufferDelegate> {
|
||||||
|
|
||||||
@implementation ViewController
|
@implementation ViewController
|
||||||
|
|
||||||
|
- (void)dealloc {
|
||||||
|
[[OlaFaceUnity sharedInstance] dispose];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)viewDidLoad {
|
- (void)viewDidLoad {
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
self.pixelFormatType = kCVPixelFormatType_420YpCbCr8BiPlanarFullRange;
|
self.pixelFormatType = kCVPixelFormatType_420YpCbCr8BiPlanarFullRange;
|
||||||
|
@ -74,10 +78,15 @@ AVCaptureAudioDataOutputSampleBufferDelegate> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)viewWillDisappear:(BOOL)animated {
|
||||||
|
[[OlaFaceUnity sharedInstance] suspend];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)viewWillAppear:(BOOL)animated
|
- (void)viewWillAppear:(BOOL)animated
|
||||||
{
|
{
|
||||||
[super viewWillAppear:animated];
|
[super viewWillAppear:animated];
|
||||||
[self startCapture];
|
[self startCapture];
|
||||||
|
[[OlaFaceUnity sharedInstance] resume];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setupSession {
|
- (void)setupSession {
|
||||||
|
@ -132,8 +141,8 @@ AVCaptureAudioDataOutputSampleBufferDelegate> {
|
||||||
dimensions.height ==[[outputSettings objectForKey:@"Height"] intValue]) {
|
dimensions.height ==[[outputSettings objectForKey:@"Height"] intValue]) {
|
||||||
if (YES == [self.captureDevice lockForConfiguration:NULL] ) {
|
if (YES == [self.captureDevice lockForConfiguration:NULL] ) {
|
||||||
self.captureDevice.activeFormat = vFormat;
|
self.captureDevice.activeFormat = vFormat;
|
||||||
[self.captureDevice setActiveVideoMinFrameDuration:CMTimeMake(1,24)];
|
[self.captureDevice setActiveVideoMinFrameDuration:CMTimeMake(1,30)];
|
||||||
[self.captureDevice setActiveVideoMaxFrameDuration:CMTimeMake(1,24)];
|
[self.captureDevice setActiveVideoMaxFrameDuration:CMTimeMake(1,30)];
|
||||||
[self.captureDevice unlockForConfiguration];
|
[self.captureDevice unlockForConfiguration];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,10 +151,12 @@ AVCaptureAudioDataOutputSampleBufferDelegate> {
|
||||||
|
|
||||||
- (void)setupRenderView {
|
- (void)setupRenderView {
|
||||||
if(!self.renderView){
|
if(!self.renderView){
|
||||||
_renderView = [[OlaMTLCameraRenderView alloc] initWithFrame:self.view.bounds];
|
_renderView = [[OlaMTLCameraRenderView alloc] initWithFrame:self.view.bounds shareContext:[[OlaFaceUnity sharedInstance] currentContext]];
|
||||||
_renderView.cameraDelegate = self;
|
_renderView.cameraDelegate = self;
|
||||||
|
_renderView.preferredFramesPerSecond = 30;
|
||||||
[self.renderView setBackgroundColor:[UIColor colorWithRed:0.9f green:0.9f blue:0.9f alpha:1.0f]];
|
[self.renderView setBackgroundColor:[UIColor colorWithRed:0.9f green:0.9f blue:0.9f alpha:1.0f]];
|
||||||
[self.view addSubview:self.renderView];
|
[self.view addSubview:self.renderView];
|
||||||
|
[self.view sendSubviewToBack:self.renderView];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,8 +260,15 @@ AVCaptureAudioDataOutputSampleBufferDelegate> {
|
||||||
{
|
{
|
||||||
|
|
||||||
[[OlaFaceUnity sharedInstance] processVideoFrame:onScreenTexture.renderTarget timeStamp:frameTime];
|
[[OlaFaceUnity sharedInstance] processVideoFrame:onScreenTexture.renderTarget timeStamp:frameTime];
|
||||||
|
FaceTextureInfo inputTexture;
|
||||||
return onScreenTexture.surfaceID;
|
inputTexture.width = onScreenTexture.size.width;
|
||||||
|
inputTexture.height = onScreenTexture.size.height;
|
||||||
|
inputTexture.textureId = onScreenTexture.openGLTexture;
|
||||||
|
inputTexture.ioSurfaceId = onScreenTexture.surfaceID;
|
||||||
|
inputTexture.frameTime = frameTime;
|
||||||
|
FaceTextureInfo result = [[OlaFaceUnity sharedInstance] render:inputTexture];
|
||||||
|
NSLog(@"result ioSurfaceId:%d", result.ioSurfaceId);
|
||||||
|
return result.ioSurfaceId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,4 +289,10 @@ AVCaptureAudioDataOutputSampleBufferDelegate> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (IBAction)beautyChanged:(UISlider *)sender
|
||||||
|
{
|
||||||
|
[OlaFaceUnity sharedInstance].whiten = sender.value;
|
||||||
|
[OlaFaceUnity sharedInstance].smooth = sender.value;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -1,29 +1,29 @@
|
||||||
|
|
||||||
<Scheme LastUpgradeVersion="1000" version="1.3">
|
<Scheme version="1.3" LastUpgradeVersion="1000">
|
||||||
<BuildAction parallelizeBuildables="YES" buildImplicitDependencies="YES">
|
<BuildAction buildImplicitDependencies="YES" parallelizeBuildables="YES">
|
||||||
<BuildActionEntries>
|
<BuildActionEntries>
|
||||||
<BuildActionEntry buildForArchiving="YES" buildForAnalyzing="YES" buildForRunning="YES" buildForProfiling="YES" buildForTesting="YES">
|
<BuildActionEntry buildForTesting="YES" buildForRunning="YES" buildForProfiling="YES" buildForAnalyzing="YES" buildForArchiving="YES">
|
||||||
<BuildableReference BuildableIdentifier="primary" BlueprintIdentifier="F2FE34CE0C5C7AFE00000000" ReferencedContainer="container:FaceUnityFramework.xcodeproj" BuildableName="OlaFaceUnityFramework.framework" BlueprintName="OlaFaceUnityFramework"></BuildableReference>
|
<BuildableReference BlueprintIdentifier="F2FE34CE0C5C7AFE00000000" BuildableIdentifier="primary" BlueprintName="OlaFaceUnityFramework" BuildableName="OlaFaceUnityFramework.framework" ReferencedContainer="container:FaceUnityFramework.xcodeproj"></BuildableReference>
|
||||||
</BuildActionEntry>
|
</BuildActionEntry>
|
||||||
</BuildActionEntries>
|
</BuildActionEntries>
|
||||||
</BuildAction>
|
</BuildAction>
|
||||||
<TestAction shouldUseLaunchSchemeArgsEnv="YES" customLLDBInitFile="$(PROJECT_FILE_PATH)/.tulsi/Utils/lldbinit" buildConfiguration="__TulsiTestRunner_Debug" selectedDebuggerIdentifier="Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier="Xcode.DebuggerFoundation.Launcher.LLDB">
|
<TestAction buildConfiguration="__TulsiTestRunner_Debug" shouldUseLaunchSchemeArgsEnv="YES" customLLDBInitFile="$(PROJECT_FILE_PATH)/.tulsi/Utils/lldbinit" selectedDebuggerIdentifier="Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier="Xcode.DebuggerFoundation.Launcher.LLDB">
|
||||||
<Testables></Testables>
|
<Testables></Testables>
|
||||||
<BuildableProductRunnable runnableDebuggingMode="0">
|
<BuildableProductRunnable runnableDebuggingMode="0">
|
||||||
<BuildableReference BlueprintName="OlaFaceUnityFramework" BuildableName="OlaFaceUnityFramework.framework" ReferencedContainer="container:FaceUnityFramework.xcodeproj" BuildableIdentifier="primary" BlueprintIdentifier="F2FE34CE0C5C7AFE00000000"></BuildableReference>
|
<BuildableReference BuildableIdentifier="primary" BlueprintIdentifier="F2FE34CE0C5C7AFE00000000" BuildableName="OlaFaceUnityFramework.framework" ReferencedContainer="container:FaceUnityFramework.xcodeproj" BlueprintName="OlaFaceUnityFramework"></BuildableReference>
|
||||||
</BuildableProductRunnable>
|
</BuildableProductRunnable>
|
||||||
</TestAction>
|
</TestAction>
|
||||||
<LaunchAction debugDocumentVersioning="YES" launchStyle="0" ignoresPersistentStateOnLaunch="NO" allowLocationSimulation="YES" debugServiceExtension="internal" useCustomWorkingDirectory="NO" customLLDBInitFile="$(PROJECT_FILE_PATH)/.tulsi/Utils/lldbinit" selectedLauncherIdentifier="Xcode.DebuggerFoundation.Launcher.LLDB" buildConfiguration="Debug" selectedDebuggerIdentifier="Xcode.DebuggerFoundation.Debugger.LLDB">
|
<LaunchAction customLLDBInitFile="$(PROJECT_FILE_PATH)/.tulsi/Utils/lldbinit" debugServiceExtension="internal" allowLocationSimulation="YES" useCustomWorkingDirectory="NO" debugDocumentVersioning="YES" buildConfiguration="Debug" selectedLauncherIdentifier="Xcode.DebuggerFoundation.Launcher.LLDB" launchStyle="0" selectedDebuggerIdentifier="Xcode.DebuggerFoundation.Debugger.LLDB" ignoresPersistentStateOnLaunch="NO">
|
||||||
<EnvironmentVariables></EnvironmentVariables>
|
<EnvironmentVariables></EnvironmentVariables>
|
||||||
<BuildableProductRunnable runnableDebuggingMode="0">
|
<BuildableProductRunnable runnableDebuggingMode="0">
|
||||||
<BuildableReference BuildableName="OlaFaceUnityFramework.framework" BlueprintName="OlaFaceUnityFramework" ReferencedContainer="container:FaceUnityFramework.xcodeproj" BlueprintIdentifier="F2FE34CE0C5C7AFE00000000" BuildableIdentifier="primary"></BuildableReference>
|
<BuildableReference BuildableName="OlaFaceUnityFramework.framework" ReferencedContainer="container:FaceUnityFramework.xcodeproj" BuildableIdentifier="primary" BlueprintName="OlaFaceUnityFramework" BlueprintIdentifier="F2FE34CE0C5C7AFE00000000"></BuildableReference>
|
||||||
</BuildableProductRunnable>
|
</BuildableProductRunnable>
|
||||||
</LaunchAction>
|
</LaunchAction>
|
||||||
<ProfileAction useCustomWorkingDirectory="NO" debugDocumentVersioning="YES" shouldUseLaunchSchemeArgsEnv="YES" buildConfiguration="__TulsiTestRunner_Release">
|
<ProfileAction debugDocumentVersioning="YES" buildConfiguration="__TulsiTestRunner_Release" shouldUseLaunchSchemeArgsEnv="YES" useCustomWorkingDirectory="NO">
|
||||||
<BuildableProductRunnable runnableDebuggingMode="0">
|
<BuildableProductRunnable runnableDebuggingMode="0">
|
||||||
<BuildableReference BuildableName="OlaFaceUnityFramework.framework" BuildableIdentifier="primary" BlueprintName="OlaFaceUnityFramework" BlueprintIdentifier="F2FE34CE0C5C7AFE00000000" ReferencedContainer="container:FaceUnityFramework.xcodeproj"></BuildableReference>
|
<BuildableReference BlueprintIdentifier="F2FE34CE0C5C7AFE00000000" BuildableName="OlaFaceUnityFramework.framework" ReferencedContainer="container:FaceUnityFramework.xcodeproj" BlueprintName="OlaFaceUnityFramework" BuildableIdentifier="primary"></BuildableReference>
|
||||||
</BuildableProductRunnable>
|
</BuildableProductRunnable>
|
||||||
</ProfileAction>
|
</ProfileAction>
|
||||||
<AnalyzeAction buildConfiguration="Debug"></AnalyzeAction>
|
<AnalyzeAction buildConfiguration="Debug"></AnalyzeAction>
|
||||||
<ArchiveAction revealArchiveInOrganizer="YES" buildConfiguration="Release"></ArchiveAction>
|
<ArchiveAction buildConfiguration="Release" revealArchiveInOrganizer="YES"></ArchiveAction>
|
||||||
</Scheme>
|
</Scheme>
|
File diff suppressed because it is too large
Load Diff
|
@ -2,26 +2,26 @@
|
||||||
<Scheme version="1.3" LastUpgradeVersion="1000">
|
<Scheme version="1.3" LastUpgradeVersion="1000">
|
||||||
<BuildAction parallelizeBuildables="YES" buildImplicitDependencies="YES">
|
<BuildAction parallelizeBuildables="YES" buildImplicitDependencies="YES">
|
||||||
<BuildActionEntries>
|
<BuildActionEntries>
|
||||||
<BuildActionEntry buildForProfiling="YES" buildForTesting="YES" buildForRunning="YES" buildForAnalyzing="YES" buildForArchiving="YES">
|
<BuildActionEntry buildForAnalyzing="YES" buildForTesting="YES" buildForProfiling="YES" buildForRunning="YES" buildForArchiving="YES">
|
||||||
<BuildableReference BuildableIdentifier="primary" BlueprintName="mediapipe-render-module-beauty-ios-framework-OlaFaceUnityLibrary" ReferencedContainer="container:FaceUnityFramework.xcodeproj" BlueprintIdentifier="F2FE34CED4660C9200000000" BuildableName="libmediapipe-render-module-beauty-ios-framework-OlaFaceUnityLibrary.a"></BuildableReference>
|
<BuildableReference BlueprintName="mediapipe-render-module-beauty-ios-framework-OlaFaceUnityLibrary" BlueprintIdentifier="F2FE34CED4660C9200000000" ReferencedContainer="container:FaceUnityFramework.xcodeproj" BuildableIdentifier="primary" BuildableName="libmediapipe-render-module-beauty-ios-framework-OlaFaceUnityLibrary.a"></BuildableReference>
|
||||||
</BuildActionEntry>
|
</BuildActionEntry>
|
||||||
</BuildActionEntries>
|
</BuildActionEntries>
|
||||||
</BuildAction>
|
</BuildAction>
|
||||||
<TestAction selectedLauncherIdentifier="Xcode.DebuggerFoundation.Launcher.LLDB" customLLDBInitFile="$(PROJECT_FILE_PATH)/.tulsi/Utils/lldbinit" buildConfiguration="__TulsiTestRunner_Debug" selectedDebuggerIdentifier="Xcode.DebuggerFoundation.Debugger.LLDB" shouldUseLaunchSchemeArgsEnv="YES">
|
<TestAction selectedLauncherIdentifier="Xcode.DebuggerFoundation.Launcher.LLDB" customLLDBInitFile="$(PROJECT_FILE_PATH)/.tulsi/Utils/lldbinit" buildConfiguration="__TulsiTestRunner_Debug" selectedDebuggerIdentifier="Xcode.DebuggerFoundation.Debugger.LLDB" shouldUseLaunchSchemeArgsEnv="YES">
|
||||||
<Testables></Testables>
|
<Testables></Testables>
|
||||||
<BuildableProductRunnable runnableDebuggingMode="0">
|
<BuildableProductRunnable runnableDebuggingMode="0">
|
||||||
<BuildableReference BuildableName="libmediapipe-render-module-beauty-ios-framework-OlaFaceUnityLibrary.a" ReferencedContainer="container:FaceUnityFramework.xcodeproj" BuildableIdentifier="primary" BlueprintIdentifier="F2FE34CED4660C9200000000" BlueprintName="mediapipe-render-module-beauty-ios-framework-OlaFaceUnityLibrary"></BuildableReference>
|
<BuildableReference BlueprintIdentifier="F2FE34CED4660C9200000000" BuildableName="libmediapipe-render-module-beauty-ios-framework-OlaFaceUnityLibrary.a" BuildableIdentifier="primary" ReferencedContainer="container:FaceUnityFramework.xcodeproj" BlueprintName="mediapipe-render-module-beauty-ios-framework-OlaFaceUnityLibrary"></BuildableReference>
|
||||||
</BuildableProductRunnable>
|
</BuildableProductRunnable>
|
||||||
</TestAction>
|
</TestAction>
|
||||||
<LaunchAction debugDocumentVersioning="YES" allowLocationSimulation="YES" debugServiceExtension="internal" useCustomWorkingDirectory="NO" launchStyle="0" buildConfiguration="Debug" customLLDBInitFile="$(PROJECT_FILE_PATH)/.tulsi/Utils/lldbinit" selectedDebuggerIdentifier="Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier="Xcode.DebuggerFoundation.Launcher.LLDB" ignoresPersistentStateOnLaunch="NO">
|
<LaunchAction launchStyle="0" selectedLauncherIdentifier="Xcode.DebuggerFoundation.Launcher.LLDB" ignoresPersistentStateOnLaunch="NO" debugDocumentVersioning="YES" useCustomWorkingDirectory="NO" debugServiceExtension="internal" customLLDBInitFile="$(PROJECT_FILE_PATH)/.tulsi/Utils/lldbinit" allowLocationSimulation="YES" buildConfiguration="Debug" selectedDebuggerIdentifier="Xcode.DebuggerFoundation.Debugger.LLDB">
|
||||||
<EnvironmentVariables></EnvironmentVariables>
|
<EnvironmentVariables></EnvironmentVariables>
|
||||||
<MacroExpansion>
|
<MacroExpansion>
|
||||||
<BuildableReference BlueprintIdentifier="F2FE34CED4660C9200000000" BuildableName="libmediapipe-render-module-beauty-ios-framework-OlaFaceUnityLibrary.a" BlueprintName="mediapipe-render-module-beauty-ios-framework-OlaFaceUnityLibrary" BuildableIdentifier="primary" ReferencedContainer="container:FaceUnityFramework.xcodeproj"></BuildableReference>
|
<BuildableReference BuildableName="libmediapipe-render-module-beauty-ios-framework-OlaFaceUnityLibrary.a" BlueprintName="mediapipe-render-module-beauty-ios-framework-OlaFaceUnityLibrary" ReferencedContainer="container:FaceUnityFramework.xcodeproj" BuildableIdentifier="primary" BlueprintIdentifier="F2FE34CED4660C9200000000"></BuildableReference>
|
||||||
</MacroExpansion>
|
</MacroExpansion>
|
||||||
</LaunchAction>
|
</LaunchAction>
|
||||||
<ProfileAction shouldUseLaunchSchemeArgsEnv="YES" buildConfiguration="__TulsiTestRunner_Release" useCustomWorkingDirectory="NO" debugDocumentVersioning="YES">
|
<ProfileAction shouldUseLaunchSchemeArgsEnv="YES" useCustomWorkingDirectory="NO" debugDocumentVersioning="YES" buildConfiguration="__TulsiTestRunner_Release">
|
||||||
<MacroExpansion>
|
<MacroExpansion>
|
||||||
<BuildableReference BuildableName="libmediapipe-render-module-beauty-ios-framework-OlaFaceUnityLibrary.a" BlueprintName="mediapipe-render-module-beauty-ios-framework-OlaFaceUnityLibrary" BuildableIdentifier="primary" BlueprintIdentifier="F2FE34CED4660C9200000000" ReferencedContainer="container:FaceUnityFramework.xcodeproj"></BuildableReference>
|
<BuildableReference ReferencedContainer="container:FaceUnityFramework.xcodeproj" BlueprintName="mediapipe-render-module-beauty-ios-framework-OlaFaceUnityLibrary" BlueprintIdentifier="F2FE34CED4660C9200000000" BuildableName="libmediapipe-render-module-beauty-ios-framework-OlaFaceUnityLibrary.a" BuildableIdentifier="primary"></BuildableReference>
|
||||||
</MacroExpansion>
|
</MacroExpansion>
|
||||||
</ProfileAction>
|
</ProfileAction>
|
||||||
<AnalyzeAction buildConfiguration="Debug"></AnalyzeAction>
|
<AnalyzeAction buildConfiguration="Debug"></AnalyzeAction>
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>SchemeUserState</key>
|
|
||||||
<dict>
|
|
||||||
<key>OlaFaceUnityFramework.xcscheme_^#shared#^_</key>
|
|
||||||
<dict>
|
|
||||||
<key>isShown</key>
|
|
||||||
<true/>
|
|
||||||
<key>orderHint</key>
|
|
||||||
<integer>5</integer>
|
|
||||||
</dict>
|
|
||||||
<key>_bazel_clean_.xcscheme_^#shared#^_</key>
|
|
||||||
<dict>
|
|
||||||
<key>orderHint</key>
|
|
||||||
<integer>6</integer>
|
|
||||||
</dict>
|
|
||||||
<key>_idx_Scheme.xcscheme_^#shared#^_</key>
|
|
||||||
<dict>
|
|
||||||
<key>isShown</key>
|
|
||||||
<false/>
|
|
||||||
<key>orderHint</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
</dict>
|
|
||||||
<key>mediapipe-render-module-beauty-ios-framework-OlaFaceUnityLibrary.xcscheme_^#shared#^_</key>
|
|
||||||
<dict>
|
|
||||||
<key>isShown</key>
|
|
||||||
<true/>
|
|
||||||
<key>orderHint</key>
|
|
||||||
<integer>4</integer>
|
|
||||||
</dict>
|
|
||||||
</dict>
|
|
||||||
<key>SuppressBuildableAutocreation</key>
|
|
||||||
<dict/>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
|
@ -14,10 +14,17 @@ typedef struct {
|
||||||
|
|
||||||
@interface OlaFaceUnity : NSObject
|
@interface OlaFaceUnity : NSObject
|
||||||
|
|
||||||
|
@property (nonatomic) CGFloat whiten;
|
||||||
|
@property (nonatomic) CGFloat smooth;
|
||||||
|
|
||||||
|
|
||||||
+ (instancetype)sharedInstance;
|
+ (instancetype)sharedInstance;
|
||||||
|
|
||||||
- (void)currentContext;
|
- (EAGLContext *)currentContext;
|
||||||
|
|
||||||
|
- (void)resume;
|
||||||
|
|
||||||
|
- (void)suspend;
|
||||||
|
|
||||||
// 算法输入
|
// 算法输入
|
||||||
- (void)processVideoFrame:(CVPixelBufferRef)pixelbuffer
|
- (void)processVideoFrame:(CVPixelBufferRef)pixelbuffer
|
||||||
|
|
|
@ -38,7 +38,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (instancetype)sharedInstance {
|
+ (instancetype)sharedInstance
|
||||||
|
{
|
||||||
static OlaFaceUnity *sharedInstance = nil;
|
static OlaFaceUnity *sharedInstance = nil;
|
||||||
static dispatch_once_t onceToken;
|
static dispatch_once_t onceToken;
|
||||||
dispatch_once(&onceToken, ^{
|
dispatch_once(&onceToken, ^{
|
||||||
|
@ -49,6 +50,7 @@
|
||||||
|
|
||||||
- (FaceTextureInfo)render:(FaceTextureInfo)inputTexture
|
- (FaceTextureInfo)render:(FaceTextureInfo)inputTexture
|
||||||
{
|
{
|
||||||
|
@autoreleasepool {
|
||||||
TextureInfo rs;
|
TextureInfo rs;
|
||||||
rs.ioSurfaceId = inputTexture.ioSurfaceId;
|
rs.ioSurfaceId = inputTexture.ioSurfaceId;
|
||||||
if (_face_module) {
|
if (_face_module) {
|
||||||
|
@ -67,20 +69,17 @@
|
||||||
result.ioSurfaceId = rs.ioSurfaceId;
|
result.ioSurfaceId = rs.ioSurfaceId;
|
||||||
result.textureId = rs.textureId;
|
result.textureId = rs.textureId;
|
||||||
result.frameTime = rs.frameTime;
|
result.frameTime = rs.frameTime;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// - (EAGLContext *)currentContext
|
|
||||||
// {
|
|
||||||
// if (_face_module) {
|
|
||||||
// return _face_module->currentContext()->currentContext();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
- (void)currentContext {
|
|
||||||
|
|
||||||
|
- (EAGLContext *)currentContext
|
||||||
|
{
|
||||||
if (_face_module) {
|
if (_face_module) {
|
||||||
_face_module->currentContext()->currentContext();
|
return _face_module->currentContext()->currentContext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,4 +93,48 @@
|
||||||
_face_module->processVideoFrame(pixelbuffer, timeStamp);
|
_face_module->processVideoFrame(pixelbuffer, timeStamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (CGFloat)whiten
|
||||||
|
{
|
||||||
|
return _face_module->getWhitening();
|
||||||
|
}
|
||||||
|
|
||||||
|
- (CGFloat)smooth
|
||||||
|
{
|
||||||
|
return _face_module->getSmoothing();
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setWhiten:(CGFloat)whiten
|
||||||
|
{
|
||||||
|
_face_module->setWhitening(whiten);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setSmooth:(CGFloat)smooth
|
||||||
|
{
|
||||||
|
_face_module->setSmoothing(smooth);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)resume
|
||||||
|
{
|
||||||
|
if (!_face_module) {
|
||||||
|
[self initModule];
|
||||||
|
}
|
||||||
|
_face_module->resume();
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)suspend
|
||||||
|
{
|
||||||
|
if (!_face_module) {
|
||||||
|
[self initModule];
|
||||||
|
}
|
||||||
|
_face_module->suspend();
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)dispose
|
||||||
|
{
|
||||||
|
_face_module->stopModule();
|
||||||
|
_face_module->suspend();
|
||||||
|
delete _face_module;
|
||||||
|
_face_module = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user