Package: anymotion-cli
AnyMotion CLIThis package provides a command line interface toAnyMotion, which is a motion analysis API using pose estimation.
It uses theAnyMotion Python SDK.It works on Python 3.6.1 or higher.InstallationInstall usingpip:$pipinstallanymotion-cliAlternatively, you can usehomebrewto install:$brewinstallnttpc/tap/anymotion-cliGetting StartedBefore using anymotion-cli, you need to tell it about your credentials which issued by theAnyMotion Portal.
You can do this in several ways:CLI commandCredentials fileEnvironment variablesThe quickest way to get started is to run theamcli configurecommand:$amcliconfigure
AnyMotionClientID:your_client_id
AnyMotionClientSecret:your_client_secretTo use environment variables, do the following:exportANYMOTION_CLIENT_ID=<your_client_id>exportANYMOTION_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.UsageYou can useamcli.amcli [OPTIONS] COMMAND [ARGS]...See the table below for more information, or run it with the--helpoption.Processing commandscommand namedescriptionuploadUpload the local movie or image file to the cloud storage.downloadDownload the drawn file.extractExtract keypoints from image or movie.analyzeAnalyze the extracted keypoint data.compareCompare the two extracted keypoint datadrawDraw based on the extracted keypoints or comparison results.The command name is represented by a verb.Display commandscommand namedescriptionimageShow the information of the uploaded images.movieShow the information of the uploaded movies.keypointShow the extracted keypoints.analysisShow the analysis results.comparisonShow the comparison results.drawingShow the information of the drawn images or movies.The command name is represented by a noun.Other commandscommand namedescriptionconfigureConfigure your AnyMotion Credentials.interactiveStart interactive mode.ExamplesDraw keypoints in image fileFirst, upload the image file.$amcliuploadimage.jpg
Success:Uploadedimage.jpgtothecloudstorage.(imageid:111)When the upload is complete, you will get animage id.
Extract keypoints using thisimage id.$amcliextract--image-id111Keypointextractionstarted.(keypointid:222)Success:Keypointextractioniscomplete.Draw points/lines to image usingkeypoint id.$amclidraw--keypoint-id222Drawingisstarted.(drawingid:333)Success:Drawingiscomplete.
Downloadedthefiletoimage.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--outoption.As shown below, you can also use--pathoption and--with-drawinginextractcommand to upload, extract keypoints, drawing at the same time.$amcliextract--pathimage.jpg--with-drawing
Success:Uploadedimage.jpgtothecloudstorage.(imageid:111)Keypointextractionstarted.(keypointid:222)Success:Keypointextractioniscomplete.

Drawingstarted.(drawingid:333)Success:Drawingiscomplete.

Downloadedthefiletoimage.jpg.Draw using rulesYou can use the rules to draw a variety of things.
In the following example, draw the lines of stick picture in red.$amclidraw--keypoint-id222--rule'{"drawingType": "stickPicture", "pattern": "all", "color": "red"}'In the following other example, draw only the skeleton.$amclidraw--keypoint-id222--bg-rule'{"skeletonOnly": true}'You can also specify it in the JSON file.$amclidraw--keypoint-id222--rule-filerule.json{"drawingType":"stickPicture","pattern":"all","color":"red"}You can also writeruleandbackgroundRuleat 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 thedocumentation.Show extracted keypointsYou can use thekeypoint showcommand to display the extracted keypoint data.$amclikeypointshow1234{"id":1234,"image":null,"movie":123,"keypoint":[{"leftKnee":[487,730],...The--onlyoption allows you to display only the keypoint data.$amclikeypointshow1234--only[{"leftKnee":[487,730],"rightKnee":[1118,703]...Withjq, it's also easy to take out only certain parts of the body.$amclikeypointshow1234--only|jq'[.[].leftKnee]'[[487,730],null,null,...The--joinoption also allows you to display related data.$amclikeypointshow1234--join{"id":1234,"image":null,"movie":{"id":123,"name":"movie","text":"Created by anymotion-cli.",..."keypoint":[{"leftKnee":[487,730],...Interactive ModeYou can use interactive mode usinginteractivecommand.$amcliinteractiveShell CompleteThe anymotion-cli supports Shell completion.For Bash, add this to~/.bashrc:eval"$(_AMCLI_COMPLETE=sourceamcli)"For Zsh, add this to~/.zshrc:eval"$(_AMCLI_COMPLETE=source_zshamcli)"For Fish, add this to~/.config/fish/completions/amcli.fish:eval(env_AMCLI_COMPLETE=source_fishamcli)Change LogSeeCHANGELOG.md.ContributingCode must work on Python 3.6 and higher.Code should followblack.Docstring should followGoogle Style.Install all development dependencies using:$poetryinstallYou can install a pre-commit hook to check:$poetryrunpre-commitinstallBefore submitting pull requests, run tests with:$poetryruntox