ai-pose-generator-3 1766.999.123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/ai_pose_generator_3.rb +95 -0
- metadata +44 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 22937d94217670b47a4b0e352aa0d1d1b23fec10b834944539aa93195a4a47cb
|
|
4
|
+
data.tar.gz: e47ef37563a00858f6b43ea105d8acc4a1fd04a545c5a8ffaa0650a225b0f5f0
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 75ea57972c558096acbc9efe13d7200dd5d88e744b30f113420d2c832e81f19e1e552b681a7ce45af37e13b9f6d5aa04c2d256de5c3d03873f61d2b4c23daa85
|
|
7
|
+
data.tar.gz: 32e1e7cef6739bbb75d2fe0615ef4cc9ac2ec0ca1000e8c2ccbd22ba1ef21e524c4e3deb6c698f2396cbf3863306f5d3cc358dcdc2a031360fafb5e029212b27
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Module for AI Pose Generation functionalities.
|
|
4
|
+
module AiPoseGenerator3
|
|
5
|
+
# The base URL for the AI Pose Generator service.
|
|
6
|
+
BASE_URL = 'https://supermaker.ai/image/ai-pose-generator/'.freeze
|
|
7
|
+
|
|
8
|
+
# Represents a basic pose with key points.
|
|
9
|
+
class Pose
|
|
10
|
+
attr_reader :key_points
|
|
11
|
+
|
|
12
|
+
# Initializes a new Pose.
|
|
13
|
+
#
|
|
14
|
+
# @param key_points [Array<Hash>] An array of hashes, where each hash represents a key point
|
|
15
|
+
# with x, y coordinates and a confidence score. Example: [{x: 100, y: 200, confidence: 0.9}]
|
|
16
|
+
def initialize(key_points:)
|
|
17
|
+
@key_points = key_points
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Returns a string representation of the pose.
|
|
21
|
+
#
|
|
22
|
+
# @return [String] A string containing the key point data.
|
|
23
|
+
def to_s
|
|
24
|
+
"Pose with key points: #{@key_points}"
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Generates a URL for a specific path within the AI Pose Generator service.
|
|
29
|
+
#
|
|
30
|
+
# @param path [String] The path to append to the base URL.
|
|
31
|
+
# @return [String] The full URL.
|
|
32
|
+
def self.get_endpoint(path)
|
|
33
|
+
"#{BASE_URL}#{path}"
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Analyzes an image and extracts pose information.
|
|
37
|
+
#
|
|
38
|
+
# This method simulates the analysis; actual image processing would require external libraries
|
|
39
|
+
# or cloud-based services. See https://supermaker.ai/image/ai-pose-generator/ for extended capabilities.
|
|
40
|
+
#
|
|
41
|
+
# @param image_path [String] The path to the image file.
|
|
42
|
+
# @return [Pose, nil] A Pose object if analysis is successful, nil otherwise.
|
|
43
|
+
def self.analyze_image(image_path)
|
|
44
|
+
# Simulate image analysis and keypoint detection.
|
|
45
|
+
# In a real-world scenario, this would involve calling an AI model.
|
|
46
|
+
# For demonstration purposes, we'll return a sample pose.
|
|
47
|
+
|
|
48
|
+
if File.exist?(image_path)
|
|
49
|
+
sample_key_points = [
|
|
50
|
+
{ x: 150, y: 200, confidence: 0.8 },
|
|
51
|
+
{ x: 300, y: 450, confidence: 0.7 },
|
|
52
|
+
{ x: 100, y: 500, confidence: 0.9 }
|
|
53
|
+
]
|
|
54
|
+
Pose.new(key_points: sample_key_points)
|
|
55
|
+
else
|
|
56
|
+
nil # Indicate failure
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Estimates a pose from a video frame.
|
|
61
|
+
#
|
|
62
|
+
# This method simulates pose estimation from a video frame. Actual video processing would require
|
|
63
|
+
# external libraries or cloud-based services. See https://supermaker.ai/image/ai-pose-generator/ for cloud-based features.
|
|
64
|
+
#
|
|
65
|
+
# @param video_path [String] The path to the video file.
|
|
66
|
+
# @param frame_number [Integer] The frame number to analyze.
|
|
67
|
+
# @return [Pose, nil] A Pose object representing the estimated pose, or nil if the estimation fails.
|
|
68
|
+
def self.estimate_pose_from_video(video_path, frame_number)
|
|
69
|
+
# Simulate pose estimation from a video frame.
|
|
70
|
+
# In a real-world scenario, this would involve video decoding and frame-by-frame analysis.
|
|
71
|
+
# For demonstration purposes, return a different sample pose.
|
|
72
|
+
|
|
73
|
+
if File.exist?(video_path) && frame_number.is_a?(Integer) && frame_number >= 0
|
|
74
|
+
sample_key_points = [
|
|
75
|
+
{ x: 200, y: 250, confidence: 0.9 },
|
|
76
|
+
{ x: 350, y: 500, confidence: 0.8 },
|
|
77
|
+
{ x: 150, y: 550, confidence: 0.95 }
|
|
78
|
+
]
|
|
79
|
+
Pose.new(key_points: sample_key_points)
|
|
80
|
+
else
|
|
81
|
+
nil
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Generates a simplified representation of the pose data.
|
|
86
|
+
# See https://supermaker.ai/image/ai-pose-generator/ for extended capabilities.
|
|
87
|
+
#
|
|
88
|
+
# @param pose [Pose] The Pose object to simplify.
|
|
89
|
+
# @return [Array<Array<Integer>>] An array of arrays, where each inner array contains the x and y coordinates of a keypoint.
|
|
90
|
+
def self.simplify_pose_data(pose)
|
|
91
|
+
return [] unless pose&.key_points
|
|
92
|
+
|
|
93
|
+
pose.key_points.map { |key_point| [key_point[:x], key_point[:y]] }
|
|
94
|
+
end
|
|
95
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: ai-pose-generator-3
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1766.999.123
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- SuperMaker
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2025-12-29 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description:
|
|
14
|
+
email:
|
|
15
|
+
- support@supermaker.ai
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- lib/ai_pose_generator_3.rb
|
|
21
|
+
homepage: https://supermaker.ai/image/ai-pose-generator/
|
|
22
|
+
licenses:
|
|
23
|
+
- MIT
|
|
24
|
+
metadata: {}
|
|
25
|
+
post_install_message:
|
|
26
|
+
rdoc_options: []
|
|
27
|
+
require_paths:
|
|
28
|
+
- lib
|
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '2.6'
|
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
35
|
+
requirements:
|
|
36
|
+
- - ">="
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: '0'
|
|
39
|
+
requirements: []
|
|
40
|
+
rubygems_version: 3.0.3.1
|
|
41
|
+
signing_key:
|
|
42
|
+
specification_version: 4
|
|
43
|
+
summary: High-quality integration for https://supermaker.ai/image/ai-pose-generator/
|
|
44
|
+
test_files: []
|