Mediapipe: How do I access the landmark points in the java layer?

Created on 19 Sep 2019  路  6Comments  路  Source: google/mediapipe

I am trying to send POST requests to a server based on gestures (hand tracking example) recognized through the landmark points. I saw that the landmark points are available in most calculators but transferring them to the java layer (specifically MainActivity.java) seems tricky. Any suggestions would be great!

feature request hands

Most helpful comment

@lcycoding thx so much! that works, simple and rough.:)

  Have you implemented it? Can you share how do access the landmark points in the java layer?

All 6 comments

Try to revise calculator itself sending out vector(or any other compatible forms) represents landmark points
Then adding PacketCallback like this to get the data from graph
At least this works for me on my own face calculator graph

processor.getGraph().addPacketCallback("output_vector", new PacketCallback() {
       @Override
       public void process(Packet packet) {
              float[] dest = PacketGetter.getFloat32Vector(packet);
              // Do something with the landmark point
       }
});

@lcycoding how to add "output_vector" in graph? would you please share more detail? thx very much!!!

I do know how to get face detector result too...

@liyuming1978 in your node.cc
How about just adding outputs in GetContract()

  if (cc->Outputs().HasTag("OUT_VEC")) {
    cc->Outputs().Tag("OUT_VEC").Set<std::vector<float>>();
  }

And in process()

 cc->Outputs().Tag("OUT_VEC").Add(output_vecs.release(),
                                         cc->InputTimestamp());

The other part is pure c code part, just code it...

@lcycoding thx so much! that works, simple and rough.:)

@lcycoding thx so much! that works, simple and rough.:)

  Have you implemented it? Can you share how do access the landmark points in the java layer?
Was this page helpful?
0 / 5 - 0 ratings

Related issues

PrinceP picture PrinceP  路  5Comments

Devin0202 picture Devin0202  路  5Comments

karfly picture karfly  路  3Comments

7AM7 picture 7AM7  路  5Comments

davidakr picture davidakr  路  4Comments