AnyMotion CLI
This package provides a command line interface to AnyMotion, which is a motion analysis API using pose estimation. It uses the AnyMotion Python SDK.
It works on Python 3.6.1 or higher.
Installation
Install using pip:
$ pip install anymotion-cli
Alternatively, you can use homebrew to install:
$ brew install nttpc/tap/anymotion-cli
Getting Started
Before using anymotion-cli, you need to tell it about your credentials which issued by the AnyMotion Portal. You can do this in several ways:
- CLI command
- Credentials file
- Environment variables
The quickest way to get started is to run the amcli configure command:
$ amcli configure
AnyMotion Client ID: your_client_id
AnyMotion Client Secret: your_client_secret
To use environment variables, do the following:
export ANYMOTION_CLIENT_ID=<your_client_id>
export ANYMOTION_CLIENT_SECRET=<your_client_secret>
To use the credentials file, create an INI formatted file like this:
[default]
anymotion_client_id=<your_client_id>
anymotion_client_secret=<your_client_secret>
and place it in ~/.anymotion/credentials.
Note: If set in both the credentials file and environment variables, the environment variables takes precedence.
Usage
You can use amcli.
amcli [OPTIONS] COMMAND [ARGS]...
See the table below for more information, or run it with the --help option.
Processing commands
| command name | description |
|---|---|
| upload | Upload the local movie or image file to the cloud storage. |
| download | Download the drawn file. |
| extract | Extract keypoints from image or movie. |
| analyze | Analyze the extracted keypoint data. |
| compare | Compare the two extracted keypoint data |
| draw | Draw based on the extracted keypoints or comparison results. |
The command name is represented by a verb.
Display commands
| command name | description |
|---|---|
| image | Show the information of the uploaded images. |
| movie | Show the information of the uploaded movies. |
| keypoint | Show the extracted keypoints. |
| analysis | Show the analysis results. |
| comparison | Show the comparison results. |
| drawing | Show the information of the drawn images or movies. |
The command name is represented by a noun.
Other commands
| command name | description |
|---|---|
| configure | Configure your AnyMotion Credentials. |
| interactive | Start interactive mode. |
Examples
Draw keypoints in image file
First, upload the image file.
$ amcli upload image.jpg
Success: Uploaded image.jpg to the cloud storage. (image id: 111)
When the upload is complete, you will get an image id.
Extract keypoints using this image id.
$ amcli extract --image-id 111
Keypoint extraction started. (keypoint id: 222)
Success: Keypoint extraction is complete.
Draw points/lines to image using keypoint id.
$ amcli draw --keypoint-id 222
Drawing is started. (drawing id: 333)
Success: Drawing is complete.
Downloaded the file to image.jpg.
When the drawing is complete, the drawing file is downloaded (by default, to the current directory).
To save to a specific file or directory, use the --out option.
As shown below, you can also use --path option and --with-drawing in extract command to upload, extract keypoints, drawing at the same time.
$ amcli extract --path image.jpg --with-drawing
Success: Uploaded image.jpg to the cloud storage. (image id: 111)
Keypoint extraction started. (keypoint id: 222)
Success: Keypoint extraction is complete.
Drawing started. (drawing id: 333)
Success: Drawing is complete.
Downloaded the file to image.jpg.
Draw using rules
You can use the rules to draw a variety of things. In the following example, draw the lines of stick picture in red.
$ amcli draw --keypoint-id 222 --rule '{"drawingType": "stickPicture", "pattern": "all", "color": "red"}'
In the following other example, draw only the skeleton.
$ amcli draw --keypoint-id 222 --bg-rule '{"skeletonOnly": true}'
You can also specify it in the JSON file.
$ amcli draw --keypoint-id 222 --rule-file rule.json
{
"drawingType": "stickPicture",
"pattern": "all",
"color": "red"
}
You can also write rule and backgroundRule at the same time when using --rule-file.
{
"rule": {
"drawingType": "stickPicture",
"pattern": "all",
"color": "red"
},
"backgroundRule": {
"skeletonOnly": true
}
}
For more information on the drawing rules, see the documentation.
Show extracted keypoints
You can use the keypoint show command to display the extracted keypoint data.
$ amcli keypoint show 1234
{
"id": 1234,
"image": null,
"movie": 123,
"keypoint": [
{
"leftKnee": [
487,
730
],
...
The --only option allows you to display only the keypoint data.
$ amcli keypoint show 1234 --only
[
{
"leftKnee": [
487,
730
],
"rightKnee": [
1118,
703
]
...
With jq, it's also easy to take out only certain parts of the body.
$ amcli keypoint show 1234 --only | jq '[.[].leftKnee]'
[
[
487,
730
],
null,
null,
...
The --join option also allows you to display related data.
$ amcli keypoint show 1234 --join
{
"id": 1234,
"image": null,
"movie": {
"id": 123,
"name": "movie",
"text": "Created by anymotion-cli.",
...
"keypoint": [
{
"leftKnee": [
487,
730
],
...
Interactive Mode
You can use interactive mode using interactive command.
$ amcli interactive
Shell Complete
The anymotion-cli supports Shell completion.
For Bash, add this to ~/.bashrc:
eval "$(_AMCLI_COMPLETE=source amcli)"
For Zsh, add this to ~/.zshrc:
eval "$(_AMCLI_COMPLETE=source_zsh amcli)"
For Fish, add this to ~/.config/fish/completions/amcli.fish:
eval (env _AMCLI_COMPLETE=source_fish amcli)
Change Log
See CHANGELOG.md.
Contributing
-
Code must work on Python 3.6 and higher.
-
Code should follow black.
-
Docstring should follow Google Style.
-
Install all development dependencies using:
$ poetry install
-
You can install a pre-commit hook to check:
$ poetry run pre-commit install
-
Before submitting pull requests, run tests with:
$ poetry run tox
Metadata
Release files for anymotion-cli 1.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| anymotion-cli-1.3.2.tar.gz | 27.1 kB | Without provenance | Details for anymotion-cli-1.3.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| anymotion_cli-1.3.2-py3-none-any.whl | Python 3 | none | any | Details for anymotion_cli-1.3.2-py3-none-any.whl |
Total release size: 65.1 kB
Release files / anymotion-cli-1.3.2.tar.gz
| Download URL | anymotion-cli-1.3.2.tar.gz |
|---|---|
| Size | 27.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
64895f62257e1ca683b903b7a1803fc1b43e1c7cc2e8a056d2391668ada0fb84
|
|
BLAKE2b-256 checksum How to use checksums |
2e674089f21453c9777ef42ecaf5fc843a3b75047af6ab937524485839f47523
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7
|
Release files / anymotion_cli-1.3.2-py3-none-any.whl
| Download URL | anymotion_cli-1.3.2-py3-none-any.whl |
|---|---|
| Size | 38.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
636c4f2192dd14f8799edfc727906293960dcb7e69258f8c8ec2eb8f536e462e
|
|
BLAKE2b-256 checksum How to use checksums |
f6be7fff689c3c2066b177cef5be318fd714002a94f0fc3b7d26b79d667db4cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7
|
Security for anymotion-cli 1.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.