-1

I'm using Mediapipe framework to detect hands and i want to display own image on finger's landmark. The library provides landmarks in form of "Normalized Device Coordinate"(0...1). So i need to convert these coordinates to device(phone) coordinates in form of pixels.

Tried

  int  width= device_width;
  int  height= device_height;

        float  x = (float) ( handLandmarkList.get(HandLandmark.RING_FINGER_PIP).getX() * width );
        float  y = (float) (  handLandmarkList.get(HandLandmark.RING_FINGER_PIP).getY()*height );

x and y coordinates are not showing correct on device.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
kulvinder
  • 529
  • 5
  • 17
  • What does "not showing correct" mean? Are the device_width and device_height values correct? In the right orientation? – solidpixel Sep 20 '22 at 21:43

1 Answers1

0

You need to multiply NDCs by your render target dimensions.

solidpixel
  • 10,688
  • 1
  • 20
  • 33