-
-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sdk): implement FaceGeometryPacket
- Loading branch information
Showing
15 changed files
with
214 additions
and
13 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
Packages/com.github.homuler.mediapipe/Runtime/Scripts/Framework/Packet/FaceGeometryPacket.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System; | ||
|
||
namespace Mediapipe { | ||
public class FaceGeometryPacket : Packet<FaceGeometry.FaceGeometry> { | ||
public FaceGeometryPacket() : base() {} | ||
public FaceGeometryPacket(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) {} | ||
|
||
public override FaceGeometry.FaceGeometry Get() { | ||
UnsafeNativeMethods.mp_Packet__GetFaceGeometry(mpPtr, out var serializedProtoPtr).Assert(); | ||
GC.KeepAlive(this); | ||
|
||
var geometry = Protobuf.DeserializeProto<FaceGeometry.FaceGeometry>(serializedProtoPtr, FaceGeometry.FaceGeometry.Parser); | ||
UnsafeNativeMethods.mp_api_SerializedProto__delete(serializedProtoPtr); | ||
|
||
return geometry; | ||
} | ||
|
||
public override StatusOr<FaceGeometry.FaceGeometry> Consume() { | ||
throw new NotSupportedException(); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
.../com.github.homuler.mediapipe/Runtime/Scripts/Framework/Packet/FaceGeometryPacket.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
...com.github.homuler.mediapipe/Runtime/Scripts/Framework/Packet/FaceGeometryVectorPacket.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Mediapipe { | ||
public class FaceGeometryVectorPacket : Packet<List<FaceGeometry.FaceGeometry>> { | ||
public FaceGeometryVectorPacket() : base() {} | ||
public FaceGeometryVectorPacket(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) {} | ||
|
||
public override List<FaceGeometry.FaceGeometry> Get() { | ||
UnsafeNativeMethods.mp_Packet__GetFaceGeometryVector(mpPtr, out var serializedProtoVectorPtr).Assert(); | ||
GC.KeepAlive(this); | ||
|
||
var geometries = Protobuf.DeserializeProtoVector<FaceGeometry.FaceGeometry>(serializedProtoVectorPtr, FaceGeometry.FaceGeometry.Parser); | ||
UnsafeNativeMethods.mp_api_SerializedProtoVector__delete(serializedProtoVectorPtr); | ||
|
||
return geometries; | ||
} | ||
|
||
public override StatusOr<List<FaceGeometry.FaceGeometry>> Consume() { | ||
throw new NotSupportedException(); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...ithub.homuler.mediapipe/Runtime/Scripts/Framework/Packet/FaceGeometryVectorPacket.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
Packages/com.github.homuler.mediapipe/Runtime/Scripts/Protobuf/FaceGeometry.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
Packages/com.github.homuler.mediapipe/Runtime/Scripts/Protobuf/MatrixData.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
Packages/com.github.homuler.mediapipe/Runtime/Scripts/Protobuf/Mesh3D.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
load("//mediapipe_api:csharp_proto_src.bzl", "csharp_proto_src") | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
cc_library( | ||
name = "face_geometry", | ||
srcs = ["face_geometry.cc"], | ||
hdrs = ["face_geometry.h"], | ||
deps = [ | ||
"@com_google_mediapipe//mediapipe/modules/face_geometry/protos:face_geometry_cc_proto", | ||
"//mediapipe_api:common", | ||
"//mediapipe_api/external:protobuf", | ||
"//mediapipe_api/framework:packet", | ||
], | ||
alwayslink = True, | ||
) | ||
|
||
csharp_proto_src( | ||
name = "face_geometry_cs", | ||
proto_src = "mediapipe/modules/face_geometry/protos/face_geometry.proto", | ||
deps = [ | ||
"@com_google_mediapipe//mediapipe/framework/formats:protos_src", | ||
"@com_google_mediapipe//mediapipe/modules/face_geometry/protos:protos_src", | ||
], | ||
) | ||
|
||
csharp_proto_src( | ||
name = "mesh_3d_cs", | ||
proto_src = "mediapipe/modules/face_geometry/protos/mesh_3d.proto", | ||
deps = [ | ||
"@com_google_mediapipe//mediapipe/modules/face_geometry/protos:protos_src", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include "mediapipe_api/modules/face_geometry/protos/face_geometry.h" | ||
|
||
MpReturnCode mp_Packet__GetFaceGeometry(mediapipe::Packet* packet, mp_api::SerializedProto** value_out) { | ||
return mp_Packet__GetSerializedProto<mediapipe::face_geometry::FaceGeometry>(packet, value_out); | ||
} | ||
|
||
MpReturnCode mp_Packet__GetFaceGeometryVector(mediapipe::Packet* packet, mp_api::SerializedProtoVector** value_out) { | ||
return mp_Packet__GetSerializedProtoVector<mediapipe::face_geometry::FaceGeometry>(packet, value_out); | ||
} |
16 changes: 16 additions & 0 deletions
16
mediapipe_api/modules/face_geometry/protos/face_geometry.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef C_MEDIAPIPE_API_MODULES_FACE_GEOMETRY_PROTOS_FACE_GEOMETRY_H_ | ||
#define C_MEDIAPIPE_API_MODULES_FACE_GEOMETRY_PROTOS_FACE_GEOMETRY_H_ | ||
|
||
#include "mediapipe/modules/face_geometry/protos/face_geometry.pb.h" | ||
#include "mediapipe_api/common.h" | ||
#include "mediapipe_api/external/protobuf.h" | ||
#include "mediapipe_api/framework/packet.h" | ||
|
||
extern "C" { | ||
|
||
MP_CAPI(MpReturnCode) mp_Packet__GetFaceGeometry(mediapipe::Packet* packet, mp_api::SerializedProto** value_out); | ||
MP_CAPI(MpReturnCode) mp_Packet__GetFaceGeometryVector(mediapipe::Packet* packet, mp_api::SerializedProtoVector** value_out); | ||
|
||
} // extern "C" | ||
|
||
#endif // C_MEDIAPIPE_API_MODULES_FACE_GEOMETRY_PROTOS_FACE_GEOMETRY_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters