net.gdface.sdk.thrift.FaceApiThriftClient Maven / Gradle / Ivy
The newest version!
// ______________________________________________________
// Generated by codegen - https://gitee.com/l0km/codegen
// template: thrift/client/perservice/client.service.decorator.class.vm
// ______________________________________________________
package net.gdface.sdk.thrift;
import com.gitee.l0km.ximage.ImageErrorException;
import com.gitee.l0km.ximage.MatType;
import java.nio.ByteBuffer;
import java.util.List;
import java.util.Map;
import net.gdface.sdk.CodeInfo;
import net.gdface.sdk.CompareResult;
import net.gdface.sdk.FRect;
import net.gdface.sdk.FaceApi;
import net.gdface.sdk.FseResult;
import net.gdface.sdk.NotFaceDetectedException;
import com.gitee.l0km.xthrift.thrift.ClientFactory;
import com.gitee.l0km.xthrift.thrift.TypeTransformer;
import com.facebook.swift.service.RuntimeTApplicationException;
import com.google.common.net.HostAndPort;
import static com.google.common.base.Preconditions.*;
/**
* 基于thrift/swift框架生成的client端代码提供{@link FaceApi}接口的RPC实现(线程安全)
* 转发所有{@link FaceApi}接口方法到{@link #delegate()}指定的实例
* 所有服务端抛出的{@link RuntimeException}异常被封装到{@link ServiceRuntimeException}中抛出
* Example:
*
* FaceApiThriftClient thriftInstance = ClientFactory
* .builder()
* .setHostAndPort("127.0.0.1",26413)
* .build(FaceApi.class, FaceApiThriftClient.class);
*
* 计算机生成代码(generated by automated tools ThriftServiceDecoratorGenerator @author guyadong)
* @author guyadong
*
*/
public class FaceApiThriftClient implements FaceApi {
private final ClientFactory factory;
public ClientFactory getFactory() {
return factory;
}
public FaceApiThriftClient(ClientFactory factory) {
super();
this.factory = checkNotNull(factory,"factory is null");
}
/**
* @param host RPC service host
* @param port RPC service port
*/
public FaceApiThriftClient(String host,int port) {
this(ClientFactory.builder().setHostAndPort(host,port));
}
/**
* @param hostAndPort RPC service host and port
*/
public FaceApiThriftClient(HostAndPort hostAndPort) {
this(ClientFactory.builder().setHostAndPort(hostAndPort));
}
/**
* test if connectable for RPC service
* @return return {@code true} if connectable ,otherwise {@code false}
*/
public boolean testConnect(){
return factory.testConnect();
}
/**
* @return 返回{@link net.gdface.sdk.thrift.client.FaceApi}实例
*/
protected net.gdface.sdk.thrift.client.FaceApi delegate() {
return factory.applyInstance(net.gdface.sdk.thrift.client.FaceApi.class);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("FaceApiThriftClient [factory=");
builder.append(factory);
builder.append(",interface=");
builder.append(FaceApi.class.getName());
builder.append("]");
return builder.toString();
}
@Override
public double compare2Face(byte[] imgData1,
CodeInfo facePos1,
byte[] imgData2,
CodeInfo facePos2)
throws ImageErrorException,NotFaceDetectedException{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return instance.compare2Face(imgData1,
TypeTransformer.getInstance().to(
facePos1,
CodeInfo.class,
net.gdface.sdk.thrift.client.CodeInfo.class),
imgData2,
TypeTransformer.getInstance().to(
facePos2,
CodeInfo.class,
net.gdface.sdk.thrift.client.CodeInfo.class));
}
catch(net.gdface.sdk.thrift.client.ImageErrorException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.ImageErrorException.class,
ImageErrorException.class);
}
catch(net.gdface.sdk.thrift.client.NotFaceDetectedException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.NotFaceDetectedException.class,
NotFaceDetectedException.class);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public double compareCode(byte[] code1,
byte[] code2)
{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return instance.compareCode(code1,
code2);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public double[] compareCodes(byte[] code1,
CodeInfo[] codes)
{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return TypeTransformer.getInstance().todoubleArray(
instance.compareCodes(code1,
TypeTransformer.getInstance().to(
codes,
CodeInfo.class,
net.gdface.sdk.thrift.client.CodeInfo.class)),
double.class,
double.class);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
catch(RuntimeTApplicationException e){
return com.gitee.l0km.xthrift.thrift.ThriftUtils.returnNull(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public CompareResult compareFaces(byte[] code,
byte[] imgData,
int faceNum)
throws ImageErrorException,NotFaceDetectedException{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return TypeTransformer.getInstance().to(
instance.compareFaces(code,
imgData,
faceNum),
net.gdface.sdk.thrift.client.CompareResult.class,
CompareResult.class);
}
catch(net.gdface.sdk.thrift.client.ImageErrorException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.ImageErrorException.class,
ImageErrorException.class);
}
catch(net.gdface.sdk.thrift.client.NotFaceDetectedException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.NotFaceDetectedException.class,
NotFaceDetectedException.class);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
catch(RuntimeTApplicationException e){
return com.gitee.l0km.xthrift.thrift.ThriftUtils.returnNull(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public List compareFeatures(byte[] code1,
List codes)
{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return instance.compareFeatures(code1,
codes);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
catch(RuntimeTApplicationException e){
return com.gitee.l0km.xthrift.thrift.ThriftUtils.returnNull(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public double detectAndCompare2Face(byte[] imgData1,
FRect detectRect1,
byte[] imgData2,
FRect detectRect2)
throws ImageErrorException,NotFaceDetectedException{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return instance.detectAndCompare2Face(imgData1,
TypeTransformer.getInstance().to(
detectRect1,
FRect.class,
net.gdface.sdk.thrift.client.FRect.class),
imgData2,
TypeTransformer.getInstance().to(
detectRect2,
FRect.class,
net.gdface.sdk.thrift.client.FRect.class));
}
catch(net.gdface.sdk.thrift.client.ImageErrorException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.ImageErrorException.class,
ImageErrorException.class);
}
catch(net.gdface.sdk.thrift.client.NotFaceDetectedException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.NotFaceDetectedException.class,
NotFaceDetectedException.class);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public CodeInfo[] detectAndGetCodeInfo(byte[] imgData,
int faceNum)
throws ImageErrorException,NotFaceDetectedException{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return TypeTransformer.getInstance().toArray(
instance.detectAndGetCodeInfo(imgData,
faceNum),
net.gdface.sdk.thrift.client.CodeInfo.class,
CodeInfo.class);
}
catch(net.gdface.sdk.thrift.client.ImageErrorException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.ImageErrorException.class,
ImageErrorException.class);
}
catch(net.gdface.sdk.thrift.client.NotFaceDetectedException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.NotFaceDetectedException.class,
NotFaceDetectedException.class);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
catch(RuntimeTApplicationException e){
return com.gitee.l0km.xthrift.thrift.ThriftUtils.returnNull(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public CodeInfo detectCenterFace(byte[] imgData)
throws ImageErrorException,NotFaceDetectedException{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return TypeTransformer.getInstance().to(
instance.detectCenterFace(imgData),
net.gdface.sdk.thrift.client.CodeInfo.class,
CodeInfo.class);
}
catch(net.gdface.sdk.thrift.client.ImageErrorException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.ImageErrorException.class,
ImageErrorException.class);
}
catch(net.gdface.sdk.thrift.client.NotFaceDetectedException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.NotFaceDetectedException.class,
NotFaceDetectedException.class);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
catch(RuntimeTApplicationException e){
return com.gitee.l0km.xthrift.thrift.ThriftUtils.returnNull(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public CodeInfo[] detectFace(byte[] imgData)
throws ImageErrorException{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return TypeTransformer.getInstance().toArray(
instance.detectFace(imgData),
net.gdface.sdk.thrift.client.CodeInfo.class,
CodeInfo.class);
}
catch(net.gdface.sdk.thrift.client.ImageErrorException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.ImageErrorException.class,
ImageErrorException.class);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
catch(RuntimeTApplicationException e){
return com.gitee.l0km.xthrift.thrift.ThriftUtils.returnNull(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public CodeInfo[] detectFace(byte[] imgData,
String jsonOptions)
throws ImageErrorException{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return TypeTransformer.getInstance().toArray(
instance.detectFaceWithOptions(imgData,
jsonOptions),
net.gdface.sdk.thrift.client.CodeInfo.class,
CodeInfo.class);
}
catch(net.gdface.sdk.thrift.client.ImageErrorException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.ImageErrorException.class,
ImageErrorException.class);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
catch(RuntimeTApplicationException e){
return com.gitee.l0km.xthrift.thrift.ThriftUtils.returnNull(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public CodeInfo detectMaxFace(byte[] imgData)
throws ImageErrorException,NotFaceDetectedException{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return TypeTransformer.getInstance().to(
instance.detectMaxFace(imgData),
net.gdface.sdk.thrift.client.CodeInfo.class,
CodeInfo.class);
}
catch(net.gdface.sdk.thrift.client.ImageErrorException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.ImageErrorException.class,
ImageErrorException.class);
}
catch(net.gdface.sdk.thrift.client.NotFaceDetectedException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.NotFaceDetectedException.class,
NotFaceDetectedException.class);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
catch(RuntimeTApplicationException e){
return com.gitee.l0km.xthrift.thrift.ThriftUtils.returnNull(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public CodeInfo detectMaxFaceAndGetCodeInfo(byte[] imgData)
throws ImageErrorException,NotFaceDetectedException{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return TypeTransformer.getInstance().to(
instance.detectMaxFaceAndGetCodeInfo(imgData),
net.gdface.sdk.thrift.client.CodeInfo.class,
CodeInfo.class);
}
catch(net.gdface.sdk.thrift.client.ImageErrorException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.ImageErrorException.class,
ImageErrorException.class);
}
catch(net.gdface.sdk.thrift.client.NotFaceDetectedException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.NotFaceDetectedException.class,
NotFaceDetectedException.class);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
catch(RuntimeTApplicationException e){
return com.gitee.l0km.xthrift.thrift.ThriftUtils.returnNull(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public CodeInfo[] getCodeInfo(byte[] imgData,
int faceNum,
CodeInfo[] facePos)
throws NotFaceDetectedException{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return TypeTransformer.getInstance().toArray(
instance.getCodeInfo(imgData,
faceNum,
TypeTransformer.getInstance().to(
facePos,
CodeInfo.class,
net.gdface.sdk.thrift.client.CodeInfo.class)),
net.gdface.sdk.thrift.client.CodeInfo.class,
CodeInfo.class);
}
catch(net.gdface.sdk.thrift.client.NotFaceDetectedException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.NotFaceDetectedException.class,
NotFaceDetectedException.class);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
catch(RuntimeTApplicationException e){
return com.gitee.l0km.xthrift.thrift.ThriftUtils.returnNull(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public CodeInfo getCodeInfo(byte[] imgData,
CodeInfo facePos)
{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return TypeTransformer.getInstance().to(
instance.getCodeInfoSingle(imgData,
TypeTransformer.getInstance().to(
facePos,
CodeInfo.class,
net.gdface.sdk.thrift.client.CodeInfo.class)),
net.gdface.sdk.thrift.client.CodeInfo.class,
CodeInfo.class);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
catch(RuntimeTApplicationException e){
return com.gitee.l0km.xthrift.thrift.ThriftUtils.returnNull(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public byte[] getFeature(Map faces)
throws NotFaceDetectedException{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return instance.getFeature(TypeTransformer.getInstance().to(
faces,
ByteBuffer.class,
CodeInfo.class,
byte[].class,
net.gdface.sdk.thrift.client.CodeInfo.class));
}
catch(net.gdface.sdk.thrift.client.NotFaceDetectedException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.NotFaceDetectedException.class,
NotFaceDetectedException.class);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
catch(RuntimeTApplicationException e){
return com.gitee.l0km.xthrift.thrift.ThriftUtils.returnNull(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public boolean hasFace(byte[] imgData)
throws ImageErrorException{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return instance.hasFace(imgData);
}
catch(net.gdface.sdk.thrift.client.ImageErrorException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.ImageErrorException.class,
ImageErrorException.class);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public boolean isLocal(){
return false;
}
@Override
public CodeInfo[] matDetectAndGetCodeInfo(MatType matType,
byte[] matData,
int width,
int height)
{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return TypeTransformer.getInstance().toArray(
instance.matDetectAndGetCodeInfoUnchecked(TypeTransformer.getInstance().to(
matType,
MatType.class,
net.gdface.sdk.thrift.client.MatType.class),
matData,
width,
height),
net.gdface.sdk.thrift.client.CodeInfo.class,
CodeInfo.class);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
catch(RuntimeTApplicationException e){
return com.gitee.l0km.xthrift.thrift.ThriftUtils.returnNull(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public CodeInfo[] matDetectAndGetCodeInfo(MatType matType,
byte[] matData,
int width,
int height,
int faceNum)
throws NotFaceDetectedException{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return TypeTransformer.getInstance().toArray(
instance.matDetectAndGetCodeInfo(TypeTransformer.getInstance().to(
matType,
MatType.class,
net.gdface.sdk.thrift.client.MatType.class),
matData,
width,
height,
faceNum),
net.gdface.sdk.thrift.client.CodeInfo.class,
CodeInfo.class);
}
catch(net.gdface.sdk.thrift.client.NotFaceDetectedException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.NotFaceDetectedException.class,
NotFaceDetectedException.class);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
catch(RuntimeTApplicationException e){
return com.gitee.l0km.xthrift.thrift.ThriftUtils.returnNull(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public CodeInfo[] matDetectFace(MatType matType,
byte[] matData,
int width,
int height)
{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return TypeTransformer.getInstance().toArray(
instance.matDetectFace(TypeTransformer.getInstance().to(
matType,
MatType.class,
net.gdface.sdk.thrift.client.MatType.class),
matData,
width,
height),
net.gdface.sdk.thrift.client.CodeInfo.class,
CodeInfo.class);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
catch(RuntimeTApplicationException e){
return com.gitee.l0km.xthrift.thrift.ThriftUtils.returnNull(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public CodeInfo[] matDetectFace(MatType matType,
byte[] matData,
int width,
int height,
int facenum)
throws NotFaceDetectedException{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return TypeTransformer.getInstance().toArray(
instance.matDetectFaceFacenum(TypeTransformer.getInstance().to(
matType,
MatType.class,
net.gdface.sdk.thrift.client.MatType.class),
matData,
width,
height,
facenum),
net.gdface.sdk.thrift.client.CodeInfo.class,
CodeInfo.class);
}
catch(net.gdface.sdk.thrift.client.NotFaceDetectedException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.NotFaceDetectedException.class,
NotFaceDetectedException.class);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
catch(RuntimeTApplicationException e){
return com.gitee.l0km.xthrift.thrift.ThriftUtils.returnNull(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public CodeInfo matDetectMaxFace(MatType matType,
byte[] matData,
int width,
int height)
throws NotFaceDetectedException{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return TypeTransformer.getInstance().to(
instance.matDetectMaxFace(TypeTransformer.getInstance().to(
matType,
MatType.class,
net.gdface.sdk.thrift.client.MatType.class),
matData,
width,
height),
net.gdface.sdk.thrift.client.CodeInfo.class,
CodeInfo.class);
}
catch(net.gdface.sdk.thrift.client.NotFaceDetectedException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.NotFaceDetectedException.class,
NotFaceDetectedException.class);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
catch(RuntimeTApplicationException e){
return com.gitee.l0km.xthrift.thrift.ThriftUtils.returnNull(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public CodeInfo matDetectMaxFaceAndGetCodeInfo(MatType matType,
byte[] matData,
int width,
int height)
throws NotFaceDetectedException{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return TypeTransformer.getInstance().to(
instance.matDetectMaxFaceAndGetCodeInfo(TypeTransformer.getInstance().to(
matType,
MatType.class,
net.gdface.sdk.thrift.client.MatType.class),
matData,
width,
height),
net.gdface.sdk.thrift.client.CodeInfo.class,
CodeInfo.class);
}
catch(net.gdface.sdk.thrift.client.NotFaceDetectedException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.NotFaceDetectedException.class,
NotFaceDetectedException.class);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
catch(RuntimeTApplicationException e){
return com.gitee.l0km.xthrift.thrift.ThriftUtils.returnNull(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public CodeInfo[] matGetCodeInfo(MatType matType,
byte[] matData,
int width,
int height,
int facenum,
CodeInfo[] facePos)
throws NotFaceDetectedException{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return TypeTransformer.getInstance().toArray(
instance.matGetCodeInfo(TypeTransformer.getInstance().to(
matType,
MatType.class,
net.gdface.sdk.thrift.client.MatType.class),
matData,
width,
height,
facenum,
TypeTransformer.getInstance().to(
facePos,
CodeInfo.class,
net.gdface.sdk.thrift.client.CodeInfo.class)),
net.gdface.sdk.thrift.client.CodeInfo.class,
CodeInfo.class);
}
catch(net.gdface.sdk.thrift.client.NotFaceDetectedException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.NotFaceDetectedException.class,
NotFaceDetectedException.class);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
catch(RuntimeTApplicationException e){
return com.gitee.l0km.xthrift.thrift.ThriftUtils.returnNull(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public CodeInfo matGetCodeInfo(MatType matType,
byte[] matData,
int width,
int height,
CodeInfo facePos)
{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return TypeTransformer.getInstance().to(
instance.matGetCodeInfoSingle(TypeTransformer.getInstance().to(
matType,
MatType.class,
net.gdface.sdk.thrift.client.MatType.class),
matData,
width,
height,
TypeTransformer.getInstance().to(
facePos,
CodeInfo.class,
net.gdface.sdk.thrift.client.CodeInfo.class)),
net.gdface.sdk.thrift.client.CodeInfo.class,
CodeInfo.class);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
catch(RuntimeTApplicationException e){
return com.gitee.l0km.xthrift.thrift.ThriftUtils.returnNull(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public boolean matHasFace(MatType matType,
byte[] matData,
int width,
int height)
{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return instance.matHasFace(TypeTransformer.getInstance().to(
matType,
MatType.class,
net.gdface.sdk.thrift.client.MatType.class),
matData,
width,
height);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public FseResult[] matSearchFaces(MatType matType,
byte[] matData,
int width,
int height,
CodeInfo facePos,
double similarty,
int rows,
String[] imgMD5Set,
int group)
throws ImageErrorException,NotFaceDetectedException{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return TypeTransformer.getInstance().toArray(
instance.matSearchFaces(TypeTransformer.getInstance().to(
matType,
MatType.class,
net.gdface.sdk.thrift.client.MatType.class),
matData,
width,
height,
TypeTransformer.getInstance().to(
facePos,
CodeInfo.class,
net.gdface.sdk.thrift.client.CodeInfo.class),
similarty,
rows,
TypeTransformer.getInstance().to(
imgMD5Set,
String.class,
String.class),
group),
net.gdface.sdk.thrift.client.FseResult.class,
FseResult.class);
}
catch(net.gdface.sdk.thrift.client.ImageErrorException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.ImageErrorException.class,
ImageErrorException.class);
}
catch(net.gdface.sdk.thrift.client.NotFaceDetectedException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.NotFaceDetectedException.class,
NotFaceDetectedException.class);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
catch(RuntimeTApplicationException e){
return com.gitee.l0km.xthrift.thrift.ThriftUtils.returnNull(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public Boolean matWearMask(MatType matType,
byte[] matData,
int width,
int height,
CodeInfo faceInfo)
{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return instance.matWearMask(TypeTransformer.getInstance().to(
matType,
MatType.class,
net.gdface.sdk.thrift.client.MatType.class),
matData,
width,
height,
TypeTransformer.getInstance().to(
faceInfo,
CodeInfo.class,
net.gdface.sdk.thrift.client.CodeInfo.class));
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
catch(RuntimeTApplicationException e){
return com.gitee.l0km.xthrift.thrift.ThriftUtils.returnNull(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public Map sdkCapacity()
{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return TypeTransformer.getInstance().to(
instance.sdkCapacity(),
String.class,
String.class,
String.class,
String.class);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
catch(RuntimeTApplicationException e){
return com.gitee.l0km.xthrift.thrift.ThriftUtils.returnNull(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public FseResult[] searchFaces(byte[] imgData,
CodeInfo facePos,
double similarty,
int rows,
String[] imgMD5Set,
int group)
throws ImageErrorException,NotFaceDetectedException{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return TypeTransformer.getInstance().toArray(
instance.searchFaces(imgData,
TypeTransformer.getInstance().to(
facePos,
CodeInfo.class,
net.gdface.sdk.thrift.client.CodeInfo.class),
similarty,
rows,
TypeTransformer.getInstance().to(
imgMD5Set,
String.class,
String.class),
group),
net.gdface.sdk.thrift.client.FseResult.class,
FseResult.class);
}
catch(net.gdface.sdk.thrift.client.ImageErrorException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.ImageErrorException.class,
ImageErrorException.class);
}
catch(net.gdface.sdk.thrift.client.NotFaceDetectedException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.NotFaceDetectedException.class,
NotFaceDetectedException.class);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
catch(RuntimeTApplicationException e){
return com.gitee.l0km.xthrift.thrift.ThriftUtils.returnNull(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public FseResult[] searchFeatures(byte[] feature,
double similarity,
int rows,
String[] imgMD5Set,
int group)
{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return TypeTransformer.getInstance().toArray(
instance.searchFeatures(feature,
similarity,
rows,
TypeTransformer.getInstance().to(
imgMD5Set,
String.class,
String.class),
group),
net.gdface.sdk.thrift.client.FseResult.class,
FseResult.class);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
catch(RuntimeTApplicationException e){
return com.gitee.l0km.xthrift.thrift.ThriftUtils.returnNull(e);
}
finally{
factory.releaseInstance(instance);
}
}
@Override
public Boolean wearMask(byte[] imgData,
CodeInfo faceInfo)
throws ImageErrorException{
net.gdface.sdk.thrift.client.FaceApi instance = delegate();
try{
return instance.wearMask(imgData,
TypeTransformer.getInstance().to(
faceInfo,
CodeInfo.class,
net.gdface.sdk.thrift.client.CodeInfo.class));
}
catch(net.gdface.sdk.thrift.client.ImageErrorException e){
throw TypeTransformer.getInstance().to(
e,
net.gdface.sdk.thrift.client.ImageErrorException.class,
ImageErrorException.class);
}
catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
throw new ServiceRuntimeException(e);
}
catch(RuntimeTApplicationException e){
return com.gitee.l0km.xthrift.thrift.ThriftUtils.returnNull(e);
}
finally{
factory.releaseInstance(instance);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy