# Class PoseDetector

java.lang.Object
com.codename1.ai.vision.PoseDetector

All Implemented Interfaces:
  `VisionAnalyzer<Pose>, AutoCloseable`

public final class PoseDetector extends Object

Locates body joints, for rep counting, form feedback, or gesture input.

Counting arm raises from the live camera:

    VisionCameraView<Pose> view =
            new VisionCameraView<Pose>(new PoseDetector());
    view.setListener(new VisionPipelineListener<Pose>() {
        private boolean wasUp;

        public void result(Pose pose, VisionImage source) {
            Pose.Landmark wrist = pose.getLandmark(PoseLandmarks.RIGHT_WRIST);
            Pose.Landmark shoulder =
                    pose.getLandmark(PoseLandmarks.RIGHT_SHOULDER);
            if (wrist == null || shoulder == null
                    || wrist.getConfidence() < 0.6f) {
                return;
            }
            // Y grows downwards, so the wrist being "above" the shoulder is a
            // smaller Y.
            boolean up = wrist.getPosition().getY()
                    < shoulder.getPosition().getY();
            if (up && !wasUp) {
                reps++;
                repLabel.setText(String.valueOf(reps));
            }
            wasUp = up;
        }

        public void error(Throwable error) {
            Log.e(error);
        }
    });

Backends detect different subsets of the skeleton, so look joints up by name with `Pose.getLandmark(String)` and handle `null` rather than indexing a fixed array. `PoseLandmarks` holds the names.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PoseDetector()`
  Creates an analyzer using the platform default backend and options.
  `PoseDetector(VisionOptions options)`
  Creates a reusable analyzer with explicit backend and result options.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final void`
  `close()`
  Idempotently releases the retained native backend.
  `final boolean`
  `isSupported()`
  Tests the exact feature/backend pair configured for this analyzer.
  `final AsyncResource<Pose>`
  `process(VisionImage image)`
  Starts one analysis using the retained native backend.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### PoseDetector

    public PoseDetector()
    Creates an analyzer using the platform default backend and options.
    See Also:
      - `VisionOptions`

  - ### PoseDetector

    public PoseDetector(VisionOptions options)
    Creates a reusable analyzer with explicit backend and result options.
    Parameters:
      `options` - configuration captured by this analyzer; `null` uses defaults

- ## Method Details

  - ### isSupported

    public final boolean isSupported()
    Description copied from interface: `VisionAnalyzer`
    Tests the exact feature/backend pair configured for this analyzer.
    Specified by:
      `isSupported` in interface `VisionAnalyzer<T>`
    Returns:
      whether this analyzer's feature/backend is available and open

  - ### process

    public final AsyncResource<Pose> process(VisionImage image)
    Starts one analysis using the retained native backend.
    Specified by:
      `process` in interface `VisionAnalyzer<T>`
    Parameters:
      `image` - immutable encoded or raw input
    Returns:
      asynchronous typed result

  - ### close

    public final void close()
    Idempotently releases the retained native backend.
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `VisionAnalyzer<T>`