MediapipeHandtracking_GPU_Bitmap_Input icon indicating copy to clipboard operation
MediapipeHandtracking_GPU_Bitmap_Input copied to clipboard

How to get the hand landmarks?

Open bophancong opened this issue 5 years ago • 1 comments

@afsaredrisy Hi. It's a nice work. I have tried to run your code with Bitmap image successfully. However, I have a problem in obtaining the hand landmarks. Could you please let's me know how could a obtain the hand landmarks if you have tried? Thank you very much.

bophancong avatar Dec 03 '20 07:12 bophancong

@bophancong

Add this callback to the processor to get landmarks. On my custom graph, this only runs when the graph actually passes the output landmark stream as specified by OUTPUT_LANDMARKS_STREAM_NAME

  processor.addPacketCallback(
      OUTPUT_LANDMARKS_STREAM_NAME,
      (packet) -> {
        Log.d(TAG, "PACKET CALLBACK");
        byte[] landmarksRaw = PacketGetter.getProtoBytes(packet);
        try {
          NormalizedLandmarkList landmarks = NormalizedLandmarkList.parseFrom(landmarksRaw);
          if (landmarks == null) {
            Log.d(TAG, "[TS:" + packet.getTimestamp() + "] No landmarks.");
            return;
          }
        } catch (InvalidProtocolBufferException e) {
          Log.e(TAG, "Couldn't Exception received - " + e);
          return;
        }
      });

CaydenPierce avatar Feb 27 '21 16:02 CaydenPierce