sm-ai-pose-generator

A powerful Elixir library for generating AI-assisted human poses from image data. Simplifies the process of extracting and manipulating pose information for various applications.

Installation

Add sm_ai_pose_generator to your list of dependencies in mix.exs: elixir def deps do [

{:sm_ai_pose_generator, "~> 0.1.0"}

] end

Then, run mix deps.get to fetch the dependency.

Usage

This library provides functions for extracting pose data, transforming it, and utilizing it in your Elixir applications.

Example 1: Basic Pose Extraction elixir image_path = "path/to/your/image.jpg"

case SMAiPoseGenerator.extract_pose(image_path) do {:ok, pose_data} ->

IO.inspect(pose_data) # Prints the extracted pose data

->

IO.puts("Error extracting pose: #{reason}")

end

Example 2: Filtering Keypoints elixir image_path = "path/to/your/image.jpg"

case SMAiPoseGenerator.extract_pose(image_path) do {:ok, pose_data} ->

filtered_pose =
  pose_data
  |> SMAiPoseGenerator.filter_keypoints(["nose", "left_shoulder", "right_shoulder"])

IO.inspect(filtered_pose) # Prints pose data with only the specified keypoints

->

IO.puts("Error extracting pose: #{reason}")

end

Example 3: Transforming Pose Data elixir image_path = "path/to/your/image.jpg"

case SMAiPoseGenerator.extract_pose(image_path) do {:ok, pose_data} ->

transformed_pose =
  pose_data
  |> SMAiPoseGenerator.transform_pose(translate: {10, 20}, scale: 1.5)

IO.inspect(transformed_pose) # Prints the transformed pose data

->

IO.puts("Error extracting pose: #{reason}")

end

Example 4: Using Pattern Matching to Access Specific Keypoints elixir image_path = "path/to/your/image.jpg"

case SMAiPoseGenerator.extract_pose(image_path) do {:ok, %{keypoints: keypoints}} ->

# Accessing the x and y coordinates of the nose keypoint
nose_x = keypoints["nose"].x
nose_y = keypoints["nose"].y

IO.puts("Nose coordinates: x=#{nose_x}, y=#{nose_y}")

->

IO.puts("Error extracting pose: #{reason}")

end

Example 5: Chaining Operations with the Pipe Operator elixir image_path = "path/to/your/image.jpg"

case SMAiPoseGenerator.extract_pose(image_path) do {:ok, pose_data} ->

processed_pose =
  pose_data
  |> SMAiPoseGenerator.filter_keypoints(["nose", "left_eye", "right_eye"])
  |> SMAiPoseGenerator.transform_pose(scale: 0.8)
  |> IO.inspect(label: "Processed Pose")

->

IO.puts("Error: #{reason}")

end

Features

License

MIT

This package is part of the sm-ai-pose-generator ecosystem. For advanced features and enterprise-grade tools, visit: https://supermaker.ai/image/ai-pose-generator/