From b7d9f58d0c9281a486906ba213672656003a1974 Mon Sep 17 00:00:00 2001 From: Frankie Robertson Date: Tue, 23 Jun 2020 11:47:20 +0300 Subject: [PATCH 1/3] Add preset for OpenPose --- openpose/CMakeLists.patch | 29 +++ openpose/LICENSE | 108 +++++++++ openpose/README.md | 158 +++++++++++++ openpose/cppbuild.sh | 90 ++++++++ openpose/platform/pom.xml | 102 +++++++++ openpose/pom.xml | 213 ++++++++++++++++++ openpose/samples/openpose.java | 105 +++++++++ .../bytedeco/openpose/helper/openpose.java | 15 ++ .../bytedeco/openpose/presets/openpose.java | 182 +++++++++++++++ openpose/src/main/java9/module-info.java | 10 + pom.xml | 2 + 11 files changed, 1014 insertions(+) create mode 100644 openpose/CMakeLists.patch create mode 100644 openpose/LICENSE create mode 100644 openpose/README.md create mode 100755 openpose/cppbuild.sh create mode 100644 openpose/platform/pom.xml create mode 100644 openpose/pom.xml create mode 100644 openpose/samples/openpose.java create mode 100644 openpose/src/main/java/org/bytedeco/openpose/helper/openpose.java create mode 100644 openpose/src/main/java/org/bytedeco/openpose/presets/openpose.java create mode 100644 openpose/src/main/java9/module-info.java diff --git a/openpose/CMakeLists.patch b/openpose/CMakeLists.patch new file mode 100644 index 00000000000..95c3f2215dd --- /dev/null +++ b/openpose/CMakeLists.patch @@ -0,0 +1,29 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0e269073..d0d4265d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -220,6 +220,8 @@ if (${GPU_MODE} MATCHES "OPENCL") + find_package(OpenCL) + endif (${GPU_MODE} MATCHES "OPENCL") + ++find_package(Boost COMPONENTS system filesystem REQUIRED) ++ + # Code to avoid crash at compiling time if OpenCL is not found + if (NOT OpenCL_FOUND) + set(OpenCL_LIBRARIES "") +@@ -786,6 +788,7 @@ if (UNIX OR APPLE) + PREFIX ${CAFFE_PREFIX} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} ++ -DCMAKE_CXX_FLAGS="-w" + -DMKLDNN_INSTALL_DIR:PATH= + -DUSE_MKL2017_AS_DEFAULT_ENGINE=${CAFFE_CPU_ONLY} + -DUSE_CUDNN=${USE_CUDNN} +@@ -807,6 +810,7 @@ if (UNIX OR APPLE) + PREFIX ${CAFFE_PREFIX} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} ++ -DCMAKE_CXX_FLAGS="-w" + -DUSE_CUDNN=${USE_CUDNN} + -DCUDA_ARCH_NAME=${CUDA_ARCH} + -DCUDA_ARCH_BIN=${CUDA_ARCH_BIN} diff --git a/openpose/LICENSE b/openpose/LICENSE new file mode 100644 index 00000000000..71739cad835 --- /dev/null +++ b/openpose/LICENSE @@ -0,0 +1,108 @@ +OPENPOSE: MULTIPERSON KEYPOINT DETECTION +SOFTWARE LICENSE AGREEMENT +ACADEMIC OR NON-PROFIT ORGANIZATION NONCOMMERCIAL RESEARCH USE ONLY + +BY USING OR DOWNLOADING THE SOFTWARE, YOU ARE AGREEING TO THE TERMS OF THIS LICENSE AGREEMENT. IF YOU DO NOT AGREE WITH THESE TERMS, YOU MAY NOT USE OR DOWNLOAD THE SOFTWARE. + +This is a license agreement ("Agreement") between your academic institution or non-profit organization or self (called "Licensee" or "You" in this Agreement) and Carnegie Mellon University (called "Licensor" in this Agreement). All rights not specifically granted to you in this Agreement are reserved for Licensor. + +RESERVATION OF OWNERSHIP AND GRANT OF LICENSE: +Licensor retains exclusive ownership of any copy of the Software (as defined below) licensed under this Agreement and hereby grants to Licensee a personal, non-exclusive, +non-transferable license to use the Software for noncommercial research purposes, without the right to sublicense, pursuant to the terms and conditions of this Agreement. As used in this Agreement, the term "Software" means (i) the actual copy of all or any portion of code for program routines made accessible to Licensee by Licensor pursuant to this Agreement, inclusive of backups, updates, and/or merged copies permitted hereunder or subsequently supplied by Licensor, including all or any file structures, programming instructions, user interfaces and screen formats and sequences as well as any and all documentation and instructions related to it, and (ii) all or any derivatives and/or modifications created or made by You to any of the items specified in (i). + +CONFIDENTIALITY: Licensee acknowledges that the Software is proprietary to Licensor, and as such, Licensee agrees to receive all such materials in confidence and use the Software only in accordance with the terms of this Agreement. Licensee agrees to use reasonable effort to protect the Software from unauthorized use, reproduction, distribution, or publication. + +COPYRIGHT: The Software is owned by Licensor and is protected by United +States copyright laws and applicable international treaties and/or conventions. + +PERMITTED USES: The Software may be used for your own noncommercial internal research purposes. You understand and agree that Licensor is not obligated to implement any suggestions and/or feedback you might provide regarding the Software, but to the extent Licensor does so, you are not entitled to any compensation related thereto. + +DERIVATIVES: You may create derivatives of or make modifications to the Software, however, You agree that all and any such derivatives and modifications will be owned by Licensor and become a part of the Software licensed to You under this Agreement.  You may only use such derivatives and modifications for your own noncommercial internal research purposes, and you may not otherwise use, distribute or copy such derivatives and modifications in violation of this Agreement. + +BACKUPS: If Licensee is an organization, it may make that number of copies of the Software necessary for internal noncommercial use at a single site within its organization provided that all information appearing in or on the original labels, including the copyright and trademark notices are copied onto the labels of the copies. + +USES NOT PERMITTED: You may not distribute, copy or use the Software except as explicitly permitted herein. Licensee has not been granted any trademark license as part of this Agreement and may not use the name or mark “OpenPose", "Carnegie Mellon" or any renditions thereof without the prior written permission of Licensor. + +You may not sell, rent, lease, sublicense, lend, time-share or transfer, in whole or in part, or provide third parties access to prior or present versions (or any parts thereof) of the Software. + +ASSIGNMENT: You may not assign this Agreement or your rights hereunder without the prior written consent of Licensor. Any attempted assignment without such consent shall be null and void. + +TERM: The term of the license granted by this Agreement is from Licensee's acceptance of this Agreement by downloading the Software or by using the Software until terminated as provided below. + +The Agreement automatically terminates without notice if you fail to comply with any provision of this Agreement. Licensee may terminate this Agreement by ceasing using the Software. Upon any termination of this Agreement, Licensee will delete any and all copies of the Software. You agree that all provisions which operate to protect the proprietary rights of Licensor shall remain in force should breach occur and that the obligation of confidentiality described in this Agreement is binding in perpetuity and, as such, survives the term of the Agreement. + +FEE: Provided Licensee abides completely by the terms and conditions of this Agreement, there is no fee due to Licensor for Licensee's use of the Software in accordance with this Agreement. + +DISCLAIMER OF WARRANTIES: THE SOFTWARE IS PROVIDED "AS-IS" WITHOUT WARRANTY OF ANY KIND INCLUDING ANY WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE OR PURPOSE OR OF NON-INFRINGEMENT. LICENSEE BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF THE SOFTWARE AND RELATED MATERIALS. + +SUPPORT AND MAINTENANCE: No Software support or training by the Licensor is provided as part of this Agreement. + +EXCLUSIVE REMEDY AND LIMITATION OF LIABILITY: To the maximum extent permitted under applicable law, Licensor shall not be liable for direct, indirect, special, incidental, or consequential damages or lost profits related to Licensee's use of and/or inability to use the Software, even if Licensor is advised of the possibility of such damage. + +EXPORT REGULATION: Licensee agrees to comply with any and all applicable +U.S. export control laws, regulations, and/or other laws related to embargoes and sanction programs administered by the Office of Foreign Assets Control. + +SEVERABILITY: If any provision(s) of this Agreement shall be held to be invalid, illegal, or unenforceable by a court or other tribunal of competent jurisdiction, the validity, legality and enforceability of the remaining provisions shall not in any way be affected or impaired thereby. + +NO IMPLIED WAIVERS: No failure or delay by Licensor in enforcing any right or remedy under this Agreement shall be construed as a waiver of any future or other exercise of such right or remedy by Licensor. + +GOVERNING LAW: This Agreement shall be construed and enforced in accordance with the laws of the Commonwealth of Pennsylvania without reference to conflict of laws principles. You consent to the personal jurisdiction of the courts of this County and waive their rights to venue outside of Allegheny County, Pennsylvania. + +ENTIRE AGREEMENT AND AMENDMENTS: This Agreement constitutes the sole and entire agreement between Licensee and Licensor as to the matter set forth herein and supersedes any previous agreements, understandings, and arrangements between the parties relating hereto. + + + +************************************************************************ + +THIRD-PARTY SOFTWARE NOTICES AND INFORMATION + +This project incorporates material from the project(s) listed below (collectively, "Third Party Code"). This Third Party Code is licensed to you under their original license terms set forth below. We reserves all other rights not expressly granted, whether by implication, estoppel or otherwise. + +1. Caffe, version 1.0.0, (https://github.com/BVLC/caffe/) + +COPYRIGHT + +All contributions by the University of California: +Copyright (c) 2014-2017 The Regents of the University of California (Regents) +All rights reserved. + +All other contributions: +Copyright (c) 2014-2017, the respective contributors +All rights reserved. + +Caffe uses a shared copyright model: each contributor holds copyright over +their contributions to Caffe. The project versioning records all such +contribution and copyright details. If a contributor wants to further mark +their specific copyright on a particular contribution, they should indicate +their copyright solely in the commit message of the change when it is +committed. + +LICENSE + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +CONTRIBUTION AGREEMENT + +By contributing to the BVLC/caffe repository through pull-request, comment, +or otherwise, the contributor releases their content to the +license and copyright terms herein. + +************END OF THIRD-PARTY SOFTWARE NOTICES AND INFORMATION********** diff --git a/openpose/README.md b/openpose/README.md new file mode 100644 index 00000000000..79494f09355 --- /dev/null +++ b/openpose/README.md @@ -0,0 +1,158 @@ +JavaCPP Presets for Caffe +========================= + +Introduction +------------ +This directory contains the JavaCPP Presets module for: + + * OpenPose 1.6.0 https://github.com/CMU-Perceptual-Computing-Lab/openpose + +Please refer to the parent README.md file for more detailed information about the JavaCPP Presets. + + +Documentation +------------- +Java API documentation is available here: + + * http://bytedeco.org/javacpp-presets/openpose/apidocs/ + + +Sample Usage +------------ + +We can use [Maven 3](http://maven.apache.org/) to download and install automatically all the class files as well as the native binaries. To run this sample code, after creating the `pom.xml` and `openpose.java` source files below, simply execute on the command line: +```bash + $ mvn compile exec:java -Dexec.args="..." +``` + +### The `pom.xml` build file +```xml + + 4.0.0 + org.bytedeco.openpose + openpose + 1.6.0 + + openpose + + + + org.bytedeco + openpose-platform + 1.6.0-1.5.3 + + + + . + + +``` + +### The `openpose.java` source file +```java +import java.lang.System; +import org.bytedeco.javacpp.*; +import org.bytedeco.openpose.*; +import org.bytedeco.opencv.opencv_core.Mat; +import static org.bytedeco.opencv.global.opencv_imgcodecs.imread; +import static org.bytedeco.opencv.global.opencv_imgcodecs.imwrite; +import static org.bytedeco.openpose.global.openpose.ThreadManagerMode; +import static org.bytedeco.openpose.global.openpose.OP_CV2OPCONSTMAT; +import static org.bytedeco.openpose.global.openpose.OP_OP2CVCONSTMAT; +import static org.bytedeco.openpose.global.openpose.PoseMode; +import static org.bytedeco.openpose.global.openpose.ScaleMode; +import static org.bytedeco.openpose.global.openpose.RenderMode; +import static org.bytedeco.openpose.global.openpose.PoseModel; +import static org.bytedeco.openpose.global.openpose.HeatMapType; +import static org.bytedeco.openpose.global.openpose.POSE_DEFAULT_ALPHA_KEYPOINT; +import static org.bytedeco.openpose.global.openpose.POSE_DEFAULT_ALPHA_HEAT_MAP; +import org.bytedeco.openpose.OpWrapper; +import org.bytedeco.openpose.OpString; +import org.bytedeco.openpose.WrapperStructFace; +import org.bytedeco.openpose.WrapperStructHand; +import org.bytedeco.openpose.WrapperStructPose; +import org.bytedeco.openpose.Matrix; + + +public class openpose { + static WrapperStructPose mkWrapperStructPose() { + String modelFolder = System.getenv("MODEL_FOLDER"); + if (modelFolder == null) { + System.err.println("MODEL_FOLDER must be set"); + System.exit(-1); + } + WrapperStructPose structPose = new WrapperStructPose(); + structPose.modelFolder(new OpString(modelFolder)); + return structPose; + } + + public static void main(String[] args) { + // Parse command arguments + boolean doHands = false; + boolean doFace = false; + String[] pargs = new String[2]; + int pargsIdx = 0; + for (String arg : args) { + if (arg.startsWith("-")) { + if (arg.equals("--hands")) { + doHands = true; + } if (arg.equals("--face")) { + doFace = true; + } else { + System.err.println( + "Usage: [--hands] [--face] IMAGE_IN IMAGE_OUT" + ); + System.exit(-1); + } + } else { + pargs[pargsIdx] = arg; + pargsIdx += 1; + } + } + // Configure OpenPose + OpWrapper opWrapper = new OpWrapper(ThreadManagerMode.Asynchronous); + opWrapper.disableMultiThreading(); + opWrapper.configure(mkWrapperStructPose()); + if (doFace) { + WrapperStructFace face = new WrapperStructFace(); + face.enable(true); + opWrapper.configure(face); + } + if (doHands) { + WrapperStructHand hand = new WrapperStructHand(); + hand.enable(true); + opWrapper.configure(hand); + } + // Start OpenPose + opWrapper.start(); + Mat ocvIm = imread(pargs[0]); + Matrix opIm = OP_CV2OPCONSTMAT(ocvIm); + Datum dat = new Datum(); + dat.cvInputData(opIm); + Datums dats = new Datums(); + dats.put(dat); + opWrapper.emplaceAndPop(dats); + dat = dats.get(0); + // Print keypoints + FloatArray poseArray = dat.poseKeypoints(); + IntPointer dimSizes = poseArray.getSize(); + int numPeople = dimSizes.get(0); + int numJoints = dimSizes.get(1); + for (int i = 0; i < numPeople; i++) { + System.out.printf("Person %d\n", i); + for (int j = 0; j < numJoints; j++) { + System.out.printf( + "Limb %d\tx: %f\ty: %f\t: %f\n", + j, + poseArray.get(new int[] {i, j, 0})[0], + poseArray.get(new int[] {i, j, 1})[0], + poseArray.get(new int[] {i, j, 2})[0] + ); + } + } + // Save output + Mat ocvMatOut = OP_OP2CVCONSTMAT(dat.cvOutputData()); + imwrite(pargs[1], ocvMatOut); + } +} +``` diff --git a/openpose/cppbuild.sh b/openpose/cppbuild.sh new file mode 100755 index 00000000000..348b2adedd1 --- /dev/null +++ b/openpose/cppbuild.sh @@ -0,0 +1,90 @@ +#!/bin/bash +# This file is meant to be included by the parent cppbuild.sh script +if [[ -z "$PLATFORM" ]]; then + pushd .. + bash cppbuild.sh "$@" openpose + popd + exit +fi + +OPENPOSE_VERSION=1.6.0 + +download https://github.com/CMU-Perceptual-Computing-Lab/openpose/archive/v$OPENPOSE_VERSION.tar.gz openpose-$OPENPOSE_VERSION.tar.gz + +mkdir -p "$PLATFORM$EXTENSION" +cd "$PLATFORM$EXTENSION" +INSTALL_PATH=`pwd` + +OPENCV_PATH="$INSTALL_PATH/../../../opencv/cppbuild/$PLATFORM/" +CAFFE_PATH="$INSTALL_PATH/../../../caffe/cppbuild/$PLATFORM/" + +if [[ -n "${BUILD_PATH:-}" ]]; then + PREVIFS="$IFS" + IFS="$BUILD_PATH_SEPARATOR" + for P in $BUILD_PATH; do + if [[ -f "$P/include/opencv4/opencv2/core.hpp" ]]; then + OPENCV_PATH="$P" + elif [[ -f "$P/include/caffe/caffe.hpp" ]]; then + CAFFE_PATH="$P" + fi + done + IFS="$PREVIFS" +fi + +OPENCV_PATH="${OPENCV_PATH//\\//}" +CAFFE_PATH="${CAFFE_PATH//\\//}" + +echo "Decompressing archives..." +tar --totals -xzf ../openpose-$OPENPOSE_VERSION.tar.gz + +INSTALL_PATH=`pwd` + +cd openpose-$OPENPOSE_VERSION +patch -Np1 < ../../../CMakeLists.patch + +FLAGS="-DGPU_MODE=CPU_ONLY" +if [[ "$EXTENSION" == *gpu ]]; then + FLAGS="-DGPU_MODE=CUDA -DCMAKE_EXE_LINKER_FLAGS=\"-Wl,-rpath-link=/usr/local/cuda/lib64/stubs\" -DCUDA_ARCH=All" +fi + +# We're going to get all this from Caffe's build +sedinplace '/find_package(GFlags)/d' CMakeLists.txt +sedinplace '/find_package(Glog)/d' CMakeLists.txt +sedinplace '/find_package(Protobuf REQUIRED/d' CMakeLists.txt + +mkdir -p build && cd build + +case $PLATFORM in + linux-x86_64) + CC="gcc -m64" CXX="g++ -m64" $CMAKE \ + -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH" \ + -DCMAKE_INSTALL_LIBDIR="lib" \ + -DGFLAGS_FOUND:BOOL=ON \ + -DGFLAGS_INCLUDE_DIR=$CAFFE_PATH/include \ + -DGLOG_FOUND:BOOL=ON \ + -DGLOG_INCLUDE_DIR=$CAFFE_PATH/include \ + -DOpenCV_INCLUDE_DIRS=$OPENCV_PATH/include \ + -DOpenCV_LIBS=$OPENCV_PATH/lib/libopencv_core.so \ + -DOpenCV_LIBS=$OPENCV_PATH/lib/libopencv_highgui.so \ + -DOpenCV_LIBS=$OPENCV_PATH/lib/libopencv_imgproc.so \ + -DOpenCV_LIBS=$OPENCV_PATH/lib/libopencv_imgcodecs.so \ + -DCaffe_INCLUDE_DIRS=$CAFFE_PATH/include \ + -DCaffe_LIBS_RELEASE=$CAFFE_PATH/lib/libcaffe.so \ + -DCaffe_LIBS=$CAFFE_PATH/lib/libcaffe.so \ + -DProtobuf_INCLUDE_DIRS=$CAFFE_PATH/include \ + -DDOWNLOAD_BODY_25_MODEL=OFF \ + -DDOWNLOAD_FACE_MODEL=OFF \ + -DDOWNLOAD_HAND_MODEL=OFF \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_CAFFE=OFF \ + -DUSE_MKL=OFF \ + $FLAGS \ + -DCUDA_HOST_COMPILER="$(which g++)" \ + .. + ;; +esac + +make +make install + +cd ../../.. diff --git a/openpose/platform/pom.xml b/openpose/platform/pom.xml new file mode 100644 index 00000000000..5c67af6634d --- /dev/null +++ b/openpose/platform/pom.xml @@ -0,0 +1,102 @@ + + + 4.0.0 + + + org.bytedeco + javacpp-presets + 1.5.4-SNAPSHOT + ../../ + + + org.bytedeco + openpose-platform + 1.6.0-${project.parent.version} + JavaCPP Presets Platform for OpenPose + + + openpose + + + + + ${project.groupId} + ${javacpp.moduleId} + ${project.version} + + + ${project.groupId} + ${javacpp.moduleId} + ${project.version} + ${javacpp.platform.linux-x86_64} + + + + + + + maven-jar-plugin + + + default-jar + + + + ${javacpp.moduleId}.jar ${javacpp.moduleId}-linux-x86_64.jar + + + + + + empty-javadoc-jar + + jar + + + javadoc + + + + empty-sources-jar + + jar + + + sources + + + + + + org.moditect + moditect-maven-plugin + + + add-module-infos + none + + + add-platform-module-info + package + + add-module-info + + + + + ${project.build.directory}/${project.artifactId}.jar + + module org.bytedeco.${javacpp.moduleId}.platform { + requires org.bytedeco.${javacpp.moduleId}.linux.x86_64; + } + + + + + + + + + + diff --git a/openpose/pom.xml b/openpose/pom.xml new file mode 100644 index 00000000000..1d68337db69 --- /dev/null +++ b/openpose/pom.xml @@ -0,0 +1,213 @@ + + + 4.0.0 + + + org.bytedeco + javacpp-presets + 1.5.4-SNAPSHOT + + + org.bytedeco + openpose + 1.6.0-${project.parent.version} + JavaCPP Presets for OpenPose + + + + requires org.bytedeco.caffe.${javacpp.platform.module}; + requires org.bytedeco.opencv.${javacpp.platform.module}; + requires org.bytedeco.hdf5.${javacpp.platform.module}; + requires org.bytedeco.openblas.${javacpp.platform.module}; + + + + + + org.bytedeco + caffe + 1.0-${project.parent.version} + + + org.bytedeco + opencv + 4.3.0-${project.parent.version} + + + org.bytedeco + hdf5 + 1.12.0-${project.parent.version} + + + org.bytedeco + openblas + 0.3.9-${project.parent.version} + + + org.bytedeco + javacpp + + + + + + + maven-resources-plugin + + + maven-compiler-plugin + + + org.bytedeco + javacpp + + + org.bytedeco + caffe + 1.0-${project.parent.version} + + + org.bytedeco + hdf5 + 1.12.0-${project.parent.version} + + + org.bytedeco + opencv + 4.3.0-${project.parent.version} + + + org.bytedeco + openblas + 0.3.9-${project.parent.version} + + + org.bytedeco + caffe + 1.0-${project.parent.version} + ${javacpp.platform} + + + org.bytedeco + hdf5 + 1.12.0-${project.parent.version} + ${javacpp.platform} + + + org.bytedeco + opencv + 4.3.0-${project.parent.version} + ${javacpp.platform} + + + org.bytedeco + openblas + 0.3.9-${project.parent.version} + ${javacpp.platform} + + + + + ${basedir}/../caffe/target/classes/ + ${basedir}/../opencv/target/classes/ + ${basedir}/../hdf5/target/classes/ + ${basedir}/../openblas/target/classes/ + ${project.build.outputDirectory} + + + ${basedir}/../caffe/target/classes/org/bytedeco/caffe/include/ + ${basedir}/../caffe/src/main/resources/org/bytedeco/caffe/include/ + ${basedir}/../caffe/cppbuild/${javacpp.platform}/include/ + ${basedir}/../caffe/cppbuild/${javacpp.platform}/include/caffe/ + ${basedir}/../opencv/target/classes/org/bytedeco/opencv/include/ + ${basedir}/../opencv/src/main/resources/org/bytedeco/opencv/include/ + ${basedir}/../opencv/cppbuild/${javacpp.platform}/include/opencv/ + ${basedir}/../opencv/cppbuild/${javacpp.platform}/include/ + ${basedir}/../hdf5/target/classes/org/bytedeco/hdf5/include/ + ${basedir}/../hdf5/src/main/resources/org/bytedeco/hdf5/include/ + ${basedir}/../hdf5/cppbuild/${javacpp.platform}/include/ + ${basedir}/../openblas/target/classes/org/bytedeco/openblas/include/ + ${basedir}/../openblas/src/main/resources/org/bytedeco/openblas/include/ + ${basedir}/../openblas/cppbuild/${javacpp.platform}/include/ + ${basedir}/cppbuild/${javacpp.platform}${javacpp.platform.extension}/include/ + + + ${basedir}/../opencv/cppbuild/${javacpp.platform}/lib/ + ${basedir}/../hdf5/cppbuild/${javacpp.platform}/lib/ + ${basedir}/../openblas/cppbuild/${javacpp.platform}/lib/ + ${basedir}/cppbuild/${javacpp.platform}${javacpp.platform.extension}/lib/ + + + ${basedir}/../caffe/cppbuild/${javacpp.platform}/bin/ + ${basedir}/../opencv/cppbuild/${javacpp.platform}/bin/ + ${basedir}/../hdf5/cppbuild/${javacpp.platform}/bin/ + ${basedir}/../openblas/cppbuild/${javacpp.platform}/bin/ + ${basedir}/cppbuild/${javacpp.platform}${javacpp.platform.extension}/bin/ + + + /${javacpp.platform.library.path}/ + /org/bytedeco/caffe/${javacpp.platform}/ + /org/bytedeco/opencv/${javacpp.platform}/ + /org/bytedeco/hdf5/${javacpp.platform}/ + /org/bytedeco/openblas/${javacpp.platform}/ + + + /${javacpp.platform.library.path}/include/ + /org/bytedeco/caffe/include/ + /org/bytedeco/caffe/${javacpp.platform}/include/ + /org/bytedeco/opencv/include/ + /org/bytedeco/opencv/${javacpp.platform}/include/ + /org/bytedeco/hdf5/include/ + /org/bytedeco/hdf5/${javacpp.platform}/include/ + /org/bytedeco/openblas/include/ + /org/bytedeco/openblas/${javacpp.platform}/include/ + + + /${javacpp.platform.library.path}/ + /${javacpp.platform.library.path}/lib/ + /org/bytedeco/caffe/${javacpp.platform}/ + /org/bytedeco/caffe/${javacpp.platform}/lib/ + /org/bytedeco/opencv/${javacpp.platform}/ + /org/bytedeco/opencv/${javacpp.platform}/lib/ + /org/bytedeco/hdf5/${javacpp.platform}/ + /org/bytedeco/hdf5/${javacpp.platform}/lib/ + /org/bytedeco/openblas/${javacpp.platform}/ + /org/bytedeco/openblas/${javacpp.platform}/lib/ + + + + + javacpp-parser + + org.bytedeco.openpose.presets.openpose + + + + javacpp-compiler + + org.bytedeco.openpose.** + + + + + + maven-jar-plugin + + + org.moditect + moditect-maven-plugin + + + maven-dependency-plugin + + + maven-source-plugin + + + maven-javadoc-plugin + + + + + diff --git a/openpose/samples/openpose.java b/openpose/samples/openpose.java new file mode 100644 index 00000000000..9f03f1d29c1 --- /dev/null +++ b/openpose/samples/openpose.java @@ -0,0 +1,105 @@ +import java.lang.System; +import org.bytedeco.javacpp.*; +import org.bytedeco.openpose.*; +import org.bytedeco.opencv.opencv_core.Mat; +import static org.bytedeco.opencv.global.opencv_imgcodecs.imread; +import static org.bytedeco.opencv.global.opencv_imgcodecs.imwrite; +import static org.bytedeco.openpose.global.openpose.ThreadManagerMode; +import static org.bytedeco.openpose.global.openpose.OP_CV2OPCONSTMAT; +import static org.bytedeco.openpose.global.openpose.OP_OP2CVCONSTMAT; +import static org.bytedeco.openpose.global.openpose.PoseMode; +import static org.bytedeco.openpose.global.openpose.ScaleMode; +import static org.bytedeco.openpose.global.openpose.RenderMode; +import static org.bytedeco.openpose.global.openpose.PoseModel; +import static org.bytedeco.openpose.global.openpose.HeatMapType; +import static org.bytedeco.openpose.global.openpose.POSE_DEFAULT_ALPHA_KEYPOINT; +import static org.bytedeco.openpose.global.openpose.POSE_DEFAULT_ALPHA_HEAT_MAP; +import org.bytedeco.openpose.OpWrapper; +import org.bytedeco.openpose.OpString; +import org.bytedeco.openpose.WrapperStructFace; +import org.bytedeco.openpose.WrapperStructHand; +import org.bytedeco.openpose.WrapperStructPose; +import org.bytedeco.openpose.Matrix; + + +public class openpose { + static WrapperStructPose mkWrapperStructPose() { + String modelFolder = System.getenv("MODEL_FOLDER"); + if (modelFolder == null) { + System.err.println("MODEL_FOLDER must be set"); + System.exit(-1); + } + WrapperStructPose structPose = new WrapperStructPose(); + structPose.modelFolder(new OpString(modelFolder)); + return structPose; + } + + public static void main(String[] args) { + // Parse command arguments + boolean doHands = false; + boolean doFace = false; + String[] pargs = new String[2]; + int pargsIdx = 0; + for (String arg : args) { + if (arg.startsWith("-")) { + if (arg.equals("--hands")) { + doHands = true; + } if (arg.equals("--face")) { + doFace = true; + } else { + System.err.println( + "Usage: [--hands] [--face] IMAGE_IN IMAGE_OUT" + ); + System.exit(-1); + } + } else { + pargs[pargsIdx] = arg; + pargsIdx += 1; + } + } + // Configure OpenPose + OpWrapper opWrapper = new OpWrapper(ThreadManagerMode.Asynchronous); + opWrapper.disableMultiThreading(); + opWrapper.configure(mkWrapperStructPose()); + if (doFace) { + WrapperStructFace face = new WrapperStructFace(); + face.enable(true); + opWrapper.configure(face); + } + if (doHands) { + WrapperStructHand hand = new WrapperStructHand(); + hand.enable(true); + opWrapper.configure(hand); + } + // Start OpenPose + opWrapper.start(); + Mat ocvIm = imread(pargs[0]); + Matrix opIm = OP_CV2OPCONSTMAT(ocvIm); + Datum dat = new Datum(); + dat.cvInputData(opIm); + Datums dats = new Datums(); + dats.put(dat); + opWrapper.emplaceAndPop(dats); + dat = dats.get(0); + // Print keypoints + FloatArray poseArray = dat.poseKeypoints(); + IntPointer dimSizes = poseArray.getSize(); + int numPeople = dimSizes.get(0); + int numJoints = dimSizes.get(1); + for (int i = 0; i < numPeople; i++) { + System.out.printf("Person %d\n", i); + for (int j = 0; j < numJoints; j++) { + System.out.printf( + "Limb %d\tx: %f\ty: %f\t: %f\n", + j, + poseArray.get(new int[] {i, j, 0})[0], + poseArray.get(new int[] {i, j, 1})[0], + poseArray.get(new int[] {i, j, 2})[0] + ); + } + } + // Save output + Mat ocvMatOut = OP_OP2CVCONSTMAT(dat.cvOutputData()); + imwrite(pargs[1], ocvMatOut); + } +} diff --git a/openpose/src/main/java/org/bytedeco/openpose/helper/openpose.java b/openpose/src/main/java/org/bytedeco/openpose/helper/openpose.java new file mode 100644 index 00000000000..e35e61f8193 --- /dev/null +++ b/openpose/src/main/java/org/bytedeco/openpose/helper/openpose.java @@ -0,0 +1,15 @@ +package org.bytedeco.openpose.helper; + +public class openpose extends org.bytedeco.openpose.presets.openpose { + public static int POSE_MAX_PEOPLE = 127; + public static float POSE_DEFAULT_ALPHA_KEYPOINT = 0.6f; + public static float POSE_DEFAULT_ALPHA_HEAT_MAP = 0.7f; + public static int FACE_MAX_FACES = 127; + public static float FACE_DEFAULT_ALPHA_KEYPOINT = 0.6f; + public static float FACE_DEFAULT_ALPHA_HEAT_MAP = 0.7f; + public static int HAND_MAX_HANDS = 254; + public static int HAND_NUMBER_PARTS = 21; + public static float HAND_CCN_DECREASE_FACTOR = 8.0f; + public static float HAND_DEFAULT_ALPHA_KEYPOINT = 0.6f; + public static float HAND_DEFAULT_ALPHA_HEAT_MAP = 0.7f; +} diff --git a/openpose/src/main/java/org/bytedeco/openpose/presets/openpose.java b/openpose/src/main/java/org/bytedeco/openpose/presets/openpose.java new file mode 100644 index 00000000000..09f4e27ad9c --- /dev/null +++ b/openpose/src/main/java/org/bytedeco/openpose/presets/openpose.java @@ -0,0 +1,182 @@ +package org.bytedeco.openpose.presets; + +import java.util.List; +import org.bytedeco.javacpp.ClassProperties; +import org.bytedeco.javacpp.FunctionPointer; +import org.bytedeco.javacpp.LoadEnabled; +import org.bytedeco.javacpp.Loader; +import org.bytedeco.javacpp.Pointer; +import org.bytedeco.javacpp.annotation.Cast; +import org.bytedeco.javacpp.annotation.Platform; +import org.bytedeco.javacpp.annotation.Properties; +import org.bytedeco.javacpp.tools.Info; +import org.bytedeco.javacpp.tools.InfoMap; +import org.bytedeco.javacpp.tools.InfoMapper; + +import org.bytedeco.caffe.presets.*; +import org.bytedeco.opencv.presets.*; +import org.bytedeco.openblas.presets.*; +import org.bytedeco.hdf5.presets.*; + + +@Properties( + inherit = {opencv_core.class, opencv_highgui.class, opencv_imgproc.class, opencv_imgcodecs.class, openblas.class, caffe.class, hdf5.class}, + value = { + @Platform( + value = {"linux", "macosx"}, + compiler = "cpp11", + define = { + "SHARED_PTR_NAMESPACE std", + "UNIQUE_PTR_NAMESPACE std", + "GPU_MODE CPU_ONLY" + }, + include = { + "openpose/utilities/enumClasses.hpp", + "openpose/thread/enumClasses.hpp", + "openpose/pose/enumClasses.hpp", + "openpose/core/enumClasses.hpp", + "openpose/gui/enumClasses.hpp", + "openpose/producer/enumClasses.hpp", + "openpose/filestream/enumClasses.hpp", + //"openpose/gpu/enumClasses.hpp", + "openpose/wrapper/enumClasses.hpp", + + "openpose/core/matrix.hpp", + "openpose/core/array.hpp", + "openpose/core/point.hpp", + "openpose/core/rectangle.hpp", + "openpose/core/string.hpp", + "openpose/core/datum.hpp", + + "openpose/thread/worker.hpp", + + "openpose/utilities/flagsToOpenPose.hpp", + + "openpose/wrapper/wrapperStructExtra.hpp", + "openpose/wrapper/wrapperStructFace.hpp", + "openpose/wrapper/wrapperStructGui.hpp", + "openpose/wrapper/wrapperStructHand.hpp", + "openpose/wrapper/wrapperStructInput.hpp", + "openpose/wrapper/wrapperStructOutput.hpp", + "openpose/wrapper/wrapperStructPose.hpp", + "openpose/producer/producer.hpp", + "openpose/wrapper/wrapperAuxiliary.hpp", + "openpose/wrapper/wrapper.hpp", + }, + link = { + "openpose@.1.6.0", + "openpose_3d@.1.6.0", + "openpose_calibration@.1.6.0", + "openpose_core@.1.6.0", + "openpose_face@.1.6.0", + "openpose_filestream@.1.6.0", + "openpose_gpu@.1.6.0", + "openpose_gui@.1.6.0", + "openpose_hand@.1.6.0", + "openpose_net@.1.6.0", + "openpose_pose@.1.6.0", + "openpose_producer@.1.6.0", + "openpose_thread@.1.6.0", + "openpose_tracking@.1.6.0", + "openpose_unity@.1.6.0", + "openpose_utilities@.1.6.0", + "openpose_wrapper@.1.6.0", + }, + includepath = {"/usr/local/cuda/include/"}, + linkpath = "/usr/local/cuda/lib/" + ), + @Platform( + value = {"linux-x86_64"}, + define = {"GPU_MODE CUDA"}, + extension = "-gpu" + ) + }, + target = "org.bytedeco.openpose", + global = "org.bytedeco.openpose.global.openpose", + helper = "org.bytedeco.openpose.helper.openpose" +) +public class openpose implements InfoMapper { + public void map(InfoMap infoMap) { + infoMap + .put(new Info().javaText("import org.bytedeco.javacpp.annotation.Index;")) + // get rid of this + .put(new Info("OP_API").cppTypes().annotations()) + // undef things that have somehow been def'd + .put(new Info("USE_3D_ADAM_MODEL").define(false)) + .put(new Info("USE_EIGEN").define(false)) + // name clash! + .put(new Info("op::String").pointerTypes("OpString")) + + // conversion macros + .put(new Info("OP_OP2CVMAT").cppTypes("cv::Mat", "op::Matrix")) + .put(new Info("OP_OP2CVCONSTMAT").cppTypes("const cv::Mat", "op::Matrix")) + .put(new Info("OP_CV2OPMAT").cppTypes("op::Matrix", "cv::Mat")) + .put(new Info("OP_CV2OPCONSTMAT").cppTypes("const op::Matrix", "cv::Mat")) + .put(new Info("OP_OP2CVVECTOR").cppTypes("std::vector", "std::vector")) + .put(new Info("OP_CV2OPVECTOR").cppTypes("std::vector", "std::vector")) + + // template instanciations + // Datum stuff + .put(new Info("op::WrapperT >,std::shared_ptr > >,std::shared_ptr > > > > >").pointerTypes("OpWrapper").define()) + // stl containers + .put(new Info("std::vector").pointerTypes("HeatMapTypeVector").define()) + .put(new Info("std::shared_ptr").pointerTypes("Datum").annotations("@SharedPtr")) + .put(new Info("std::vector >").pointerTypes("Datums").define()) + .put(new Info("std::shared_ptr > >").pointerTypes("Datums").annotations("@SharedPtr")) + // we dealt with these instanciations directly above + .put(new Info("BASE_DATUM").skip()) + .put(new Info("BASE_DATUMS").skip()) + .put(new Info("BASE_DATUMS_SH").skip()) + + // worker stuff + .put(new Info("op::Worker > > >").pointerTypes("DatumsWorker").define()) + .put(new Info("std::shared_ptr > > > >").pointerTypes("DatumsWorker").annotations("@SharedPtr")) + + // numerical template instanciations + .put(new Info("op::Point").pointerTypes("IntPoint")) + .put(new Info("op::Point").pointerTypes("FloatPoint")) + + .put(new Info("op::Array").pointerTypes("FloatArray")) + .put(new Info("std::array,2>").pointerTypes("FloatArray2").define()) + .put(new Info("op::Array").pointerTypes("LongLongArray")) + .put(new Info("std::array").pointerTypes("Float3").define()) + .put(new Info("std::vector >").pointerTypes("Float3Vector").define()) + .put(new Info("op::Rectangle").pointerTypes("FloatRectangle")) + .put(new Info("std::array,2>").pointerTypes("FloatRectangle2").define()) + // some pairs + .put(new Info("std::pair").pointerTypes("IntStringPair").define()) + .put(new Info("std::pair").pointerTypes("ProducerOpStringPair").define()) + + // These don't match Java interface + .put(new Info("op::Point::toString").skip()) + .put(new Info("op::Point::toString").skip()) + .put(new Info("op::Array::toString").skip()) + .put(new Info("op::Array::toString").skip()) + .put(new Info("op::Rectangle::toString").skip()) + .put( + new Info( + // utilities + "op::ErrorMode", "op::LogMode", "op::Priority", "op::Extensions", + // thread + "op::ThreadManagerMode", + // wrapper + "op::PoseMode", "op::Detector", "op::WorkerType", + // producer + "op::ProducerFpsMode", "op::ProducerProperty", "op::ProducerType", + // pose + "op::PoseModel", "op::PoseProperty", + // core + "op::ScaleMode", "op::HeatMapType", "op::RenderMode", "op::ElementToRender", + // gui + "op::DisplayMode", "op::FullScreenMode", + // filestream + "op::DataFormat", "op::CocoJsonFormat" + ).enumerate() + ) + // hopefully this causes all strings to be cast to same type? + // (taken from Caffe) + .put(new Info("std::string").annotations("@StdString").valueTypes("BytePointer", "String").pointerTypes("@Cast({\"char*\", \"std::string*\"}) BytePointer")) + // don't need this + .put(new Info("OVERLOAD_C_OUT").cppText("#define OVERLOAD_C_OUT(x)")); + } +} diff --git a/openpose/src/main/java9/module-info.java b/openpose/src/main/java9/module-info.java new file mode 100644 index 00000000000..ef8f8bb4cd0 --- /dev/null +++ b/openpose/src/main/java9/module-info.java @@ -0,0 +1,10 @@ +module org.bytedeco.openpose { + requires transitive org.bytedeco.javacpp; + requires transitive org.bytedeco.caffe; + requires transitive org.bytedeco.hdf5; + requires transitive org.bytedeco.opencv; + requires transitive org.bytedeco.openblas; + exports org.bytedeco.openpose.global; + exports org.bytedeco.openpose.presets; + exports org.bytedeco.openpose; +} diff --git a/pom.xml b/pom.xml index 3c8c161a023..0548796efe9 100644 --- a/pom.xml +++ b/pom.xml @@ -611,6 +611,7 @@ leptonica tesseract caffe + openpose cuda mxnet tensorflow @@ -1329,6 +1330,7 @@ leptonica tesseract caffe + openpose cuda mxnet tensorflow From dd3576118f13d85c0993a5b926ba597bed60a205 Mon Sep 17 00:00:00 2001 From: Samuel Audet Date: Thu, 25 Jun 2020 12:26:15 +0900 Subject: [PATCH 2/3] Fix build for Linux, include build for Mac, and add to Travis CI --- .travis.yml | 4 +- CHANGELOG.md | 1 + README.md | 1 + caffe/pom.xml | 15 + .../org/bytedeco/caffe/presets/caffe.java | 2 +- ci/install-travis.sh | 2 +- cppbuild.sh | 2 +- openpose/README.md | 8 +- openpose/cppbuild.sh | 47 +- openpose/{CMakeLists.patch => openpose.patch} | 9 - openpose/platform/pom.xml | 14 +- openpose/pom.xml | 7 +- openpose/samples/pom.xml | 19 + .../gen/java/org/bytedeco/openpose/Datum.java | 385 ++++++ .../java/org/bytedeco/openpose/Datums.java | 97 ++ .../org/bytedeco/openpose/DatumsWorker.java | 47 + .../java/org/bytedeco/openpose/Float3.java | 44 + .../org/bytedeco/openpose/Float3Vector.java | 97 ++ .../org/bytedeco/openpose/FloatArray.java | 463 +++++++ .../org/bytedeco/openpose/FloatArray2.java | 44 + .../org/bytedeco/openpose/FloatPoint.java | 165 +++ .../org/bytedeco/openpose/FloatRectangle.java | 108 ++ .../bytedeco/openpose/FloatRectangle2.java | 44 + .../bytedeco/openpose/HeatMapTypeVector.java | 97 ++ .../java/org/bytedeco/openpose/IntPoint.java | 165 +++ .../org/bytedeco/openpose/IntStringPair.java | 57 + .../org/bytedeco/openpose/LongLongArray.java | 455 +++++++ .../java/org/bytedeco/openpose/Matrix.java | 144 +++ .../java/org/bytedeco/openpose/OpString.java | 65 + .../java/org/bytedeco/openpose/OpWrapper.java | 249 ++++ .../java/org/bytedeco/openpose/Producer.java | 144 +++ .../openpose/ProducerOpStringPair.java | 49 + .../bytedeco/openpose/WrapperStructExtra.java | 93 ++ .../bytedeco/openpose/WrapperStructFace.java | 109 ++ .../bytedeco/openpose/WrapperStructGui.java | 80 ++ .../bytedeco/openpose/WrapperStructHand.java | 130 ++ .../bytedeco/openpose/WrapperStructInput.java | 146 +++ .../openpose/WrapperStructOutput.java | 203 ++++ .../bytedeco/openpose/WrapperStructPose.java | 266 +++++ .../bytedeco/openpose/global/openpose.java | 1064 +++++++++++++++++ .../bytedeco/openpose/helper/openpose.java | 15 - .../bytedeco/openpose/presets/openpose.java | 77 +- platform/pom.xml | 6 + pom.xml | 1 + 44 files changed, 5174 insertions(+), 66 deletions(-) rename openpose/{CMakeLists.patch => openpose.patch} (74%) create mode 100644 openpose/samples/pom.xml create mode 100644 openpose/src/gen/java/org/bytedeco/openpose/Datum.java create mode 100644 openpose/src/gen/java/org/bytedeco/openpose/Datums.java create mode 100644 openpose/src/gen/java/org/bytedeco/openpose/DatumsWorker.java create mode 100644 openpose/src/gen/java/org/bytedeco/openpose/Float3.java create mode 100644 openpose/src/gen/java/org/bytedeco/openpose/Float3Vector.java create mode 100644 openpose/src/gen/java/org/bytedeco/openpose/FloatArray.java create mode 100644 openpose/src/gen/java/org/bytedeco/openpose/FloatArray2.java create mode 100644 openpose/src/gen/java/org/bytedeco/openpose/FloatPoint.java create mode 100644 openpose/src/gen/java/org/bytedeco/openpose/FloatRectangle.java create mode 100644 openpose/src/gen/java/org/bytedeco/openpose/FloatRectangle2.java create mode 100644 openpose/src/gen/java/org/bytedeco/openpose/HeatMapTypeVector.java create mode 100644 openpose/src/gen/java/org/bytedeco/openpose/IntPoint.java create mode 100644 openpose/src/gen/java/org/bytedeco/openpose/IntStringPair.java create mode 100644 openpose/src/gen/java/org/bytedeco/openpose/LongLongArray.java create mode 100644 openpose/src/gen/java/org/bytedeco/openpose/Matrix.java create mode 100644 openpose/src/gen/java/org/bytedeco/openpose/OpString.java create mode 100644 openpose/src/gen/java/org/bytedeco/openpose/OpWrapper.java create mode 100644 openpose/src/gen/java/org/bytedeco/openpose/Producer.java create mode 100644 openpose/src/gen/java/org/bytedeco/openpose/ProducerOpStringPair.java create mode 100644 openpose/src/gen/java/org/bytedeco/openpose/WrapperStructExtra.java create mode 100644 openpose/src/gen/java/org/bytedeco/openpose/WrapperStructFace.java create mode 100644 openpose/src/gen/java/org/bytedeco/openpose/WrapperStructGui.java create mode 100644 openpose/src/gen/java/org/bytedeco/openpose/WrapperStructHand.java create mode 100644 openpose/src/gen/java/org/bytedeco/openpose/WrapperStructInput.java create mode 100644 openpose/src/gen/java/org/bytedeco/openpose/WrapperStructOutput.java create mode 100644 openpose/src/gen/java/org/bytedeco/openpose/WrapperStructPose.java create mode 100644 openpose/src/gen/java/org/bytedeco/openpose/global/openpose.java delete mode 100644 openpose/src/main/java/org/bytedeco/openpose/helper/openpose.java diff --git a/.travis.yml b/.travis.yml index 509a800e681..6922348bcfa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -414,7 +414,7 @@ jobs: install: true script: ./ci/install-travis.sh - os: linux - env: PROJ=caffe OS=linux-x86_64 + env: PROJ=caffe,openpose OS=linux-x86_64 install: true script: ./ci/install-travis.sh - os: linux @@ -538,7 +538,7 @@ jobs: script: ./ci/install-travis.sh - os: osx osx_image: xcode9.3 - env: PROJ=caffe OS=macosx-x86_64 + env: PROJ=caffe,openpose OS=macosx-x86_64 install: true script: ./ci/install-travis.sh - os: osx diff --git a/CHANGELOG.md b/CHANGELOG.md index f72dc3056b3..08baf9a6f74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ + * Add presets for OpenPose 1.6.0 ([pull #898](https://github.com/bytedeco/javacpp-presets/pull/898)) * Add `requires org.bytedeco.javacpp.${javacpp.platform.module}` to load `jnijavacpp` with JPMS ([pull #893](https://github.com/bytedeco/javacpp-presets/pull/893)) * Bundle configuration files required by AOT compilation with GraalVM ([issue eclipse/deeplearning4j#7362](https://github.com/eclipse/deeplearning4j/issues/7362)) * Add support for Windows to presets for Qt ([issue #862](https://github.com/bytedeco/javacpp-presets/issues/862)) diff --git a/README.md b/README.md index 239040f7cb0..98a4d236e90 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,7 @@ Each child module in turn relies by default on the included [`cppbuild.sh` scrip * Leptonica 1.79.0 http://www.leptonica.org/download.html * Tesseract 4.1.1 https://github.com/tesseract-ocr/tesseract * Caffe 1.0 https://github.com/BVLC/caffe + * OpenPose 1.6.0 https://github.com/CMU-Perceptual-Computing-Lab/openpose * CUDA 10.2 https://developer.nvidia.com/cuda-downloads * cuDNN 7.6.x https://developer.nvidia.com/cudnn * NCCL 2.6.x https://developer.nvidia.com/nccl diff --git a/caffe/pom.xml b/caffe/pom.xml index f772f19f1f5..b832173cbba 100644 --- a/caffe/pom.xml +++ b/caffe/pom.xml @@ -165,6 +165,21 @@ maven-jar-plugin + + + javacpp-${javacpp.platform} + package + + + org/bytedeco/caffe/${javacpp.platform}/include/boost/** + org/bytedeco/caffe/${javacpp.platform}/lib/*.a + org/bytedeco/caffe/${javacpp.platform}/lib/*.la + org/bytedeco/caffe/${javacpp.platform}/lib/*.so* + org/bytedeco/caffe/${javacpp.platform}/lib/*.dylib + + + + org.moditect diff --git a/caffe/src/main/java/org/bytedeco/caffe/presets/caffe.java b/caffe/src/main/java/org/bytedeco/caffe/presets/caffe.java index 6d1c305e105..8164124352f 100644 --- a/caffe/src/main/java/org/bytedeco/caffe/presets/caffe.java +++ b/caffe/src/main/java/org/bytedeco/caffe/presets/caffe.java @@ -64,7 +64,7 @@ "caffe/layers/spp_layer.hpp", "caffe/layers/recurrent_layer.hpp", "caffe/layers/lstm_layer.hpp", "caffe/layers/rnn_layer.hpp", "caffe/util/benchmark.hpp", "caffe/util/db.hpp", "caffe/util/db_leveldb.hpp", "caffe/util/db_lmdb.hpp", "caffe/util/io.hpp", "caffe/util/rng.hpp", "caffe/util/im2col.hpp", "caffe/util/insert_splits.hpp", "caffe/util/mkl_alternate.hpp", "caffe/util/upgrade_proto.hpp", /* "caffe/util/cudnn.hpp" */}, link = "caffe@.1.0.0", /*resource = {"include", "lib"},*/ includepath = {"/usr/local/cuda/include/", - "/System/Library/Frameworks/vecLib.framework/", "/System/Library/Frameworks/Accelerate.framework/"}, linkpath = "/usr/local/cuda/lib/"), + "/System/Library/Frameworks/vecLib.framework/", "/System/Library/Frameworks/Accelerate.framework/"}, linkpath = "/usr/local/cuda/lib/", resource = {"include", "lib"}, linkresource = "lib"), @Platform(value = {"linux-arm64", "linux-ppc64le", "linux-x86_64", "macosx-x86_64"}, define = {"SHARED_PTR_NAMESPACE boost", "USE_LEVELDB", "USE_LMDB", "USE_OPENCV", "USE_CUDNN"}, extension = "-gpu") }) public class caffe implements LoadEnabled, InfoMapper { static { Loader.checkVersion("org.bytedeco", "caffe"); } diff --git a/ci/install-travis.sh b/ci/install-travis.sh index 2be07147403..8b60e76ea44 100755 --- a/ci/install-travis.sh +++ b/ci/install-travis.sh @@ -63,7 +63,7 @@ if [[ "$OS" == "linux-x86" ]] || [[ "$OS" == "linux-x86_64" ]] || [[ "$OS" =~ an echo "Container id is $DOCKER_CONTAINER_ID please wait while updates applied" docker exec -ti $DOCKER_CONTAINER_ID /bin/bash -xec "yum -q -y --disablerepo=cuda install centos-release-scl-rh epel-release" docker exec -ti $DOCKER_CONTAINER_ID /bin/bash -xec "yum -y repolist" - docker exec -ti $DOCKER_CONTAINER_ID /bin/bash -xec "yum -q -y --disablerepo=cuda install rh-java-common-ant $SCL_ENABLE ccache clang gcc-c++ gcc-gfortran java-1.8.0-openjdk-devel ant python python36-devel python36-pip swig file which wget unzip tar bzip2 gzip xz patch make autoconf-archive libtool bison flex perl nasm yasm alsa-lib-devel freeglut-devel gtk2-devel libusb-devel libusb1-devel curl-devel expat-devel gettext-devel openssl-devel zlib-devel SDL-devel libva-devel libxkbcommon-devel libxkbcommon-x11-devel xcb-util* fontconfig-devel libffi-devel ragel" + docker exec -ti $DOCKER_CONTAINER_ID /bin/bash -xec "yum -q -y --disablerepo=cuda install rh-java-common-ant $SCL_ENABLE boost ccache clang gcc-c++ gcc-gfortran java-1.8.0-openjdk-devel ant python python36-devel python36-pip swig file which wget unzip tar bzip2 gzip xz patch make autoconf-archive libtool bison flex perl nasm yasm alsa-lib-devel freeglut-devel gtk2-devel libusb-devel libusb1-devel curl-devel expat-devel gettext-devel openssl-devel zlib-devel SDL-devel libva-devel libxkbcommon-devel libxkbcommon-x11-devel xcb-util* fontconfig-devel libffi-devel ragel" docker exec -ti $DOCKER_CONTAINER_ID /bin/bash -xec "yum -y --disablerepo=cuda update" if [ "$OS" == "linux-x86" ]; then docker exec -ti $DOCKER_CONTAINER_ID /bin/bash -xec "rpm -qa | sed s/.x86_64$/.i686/ | xargs yum -q -y --disablerepo=cuda install" diff --git a/cppbuild.sh b/cppbuild.sh index 90e15d3253b..b101223ad8d 100755 --- a/cppbuild.sh +++ b/cppbuild.sh @@ -164,7 +164,7 @@ function sedinplace { } if [[ -z ${PROJECTS:-} ]]; then - PROJECTS=(opencv ffmpeg flycapture spinnaker libdc1394 libfreenect libfreenect2 librealsense librealsense2 videoinput artoolkitplus chilitags flandmark arrow hdf5 hyperscan mkl mkl-dnn dnnl openblas arpack-ng cminpack fftw gsl cpython numpy scipy gym llvm libpostal leptonica tesseract caffe cuda mxnet tensorflow tensorrt ale onnx ngraph onnxruntime liquidfun qt skia cpu_features systems) + PROJECTS=(opencv ffmpeg flycapture spinnaker libdc1394 libfreenect libfreenect2 librealsense librealsense2 videoinput artoolkitplus chilitags flandmark arrow hdf5 hyperscan mkl mkl-dnn dnnl openblas arpack-ng cminpack fftw gsl cpython numpy scipy gym llvm libpostal leptonica tesseract caffe openpose cuda mxnet tensorflow tensorrt ale onnx ngraph onnxruntime liquidfun qt skia cpu_features systems) fi for PROJECT in ${PROJECTS[@]}; do diff --git a/openpose/README.md b/openpose/README.md index 79494f09355..c29a525fe17 100644 --- a/openpose/README.md +++ b/openpose/README.md @@ -1,5 +1,5 @@ -JavaCPP Presets for Caffe -========================= +JavaCPP Presets for OpenPose +============================ Introduction ------------ @@ -31,7 +31,7 @@ We can use [Maven 3](http://maven.apache.org/) to download and install automatic 4.0.0 org.bytedeco.openpose openpose - 1.6.0 + 1.5.4-SNAPSHOT openpose @@ -39,7 +39,7 @@ We can use [Maven 3](http://maven.apache.org/) to download and install automatic org.bytedeco openpose-platform - 1.6.0-1.5.3 + 1.6.0-1.5.4-SNAPSHOT diff --git a/openpose/cppbuild.sh b/openpose/cppbuild.sh index 348b2adedd1..dd3099aaeb3 100755 --- a/openpose/cppbuild.sh +++ b/openpose/cppbuild.sh @@ -15,6 +15,7 @@ mkdir -p "$PLATFORM$EXTENSION" cd "$PLATFORM$EXTENSION" INSTALL_PATH=`pwd` +OPENBLAS_PATH="$INSTALL_PATH/../../../openblas/cppbuild/$PLATFORM/" OPENCV_PATH="$INSTALL_PATH/../../../opencv/cppbuild/$PLATFORM/" CAFFE_PATH="$INSTALL_PATH/../../../caffe/cppbuild/$PLATFORM/" @@ -22,7 +23,9 @@ if [[ -n "${BUILD_PATH:-}" ]]; then PREVIFS="$IFS" IFS="$BUILD_PATH_SEPARATOR" for P in $BUILD_PATH; do - if [[ -f "$P/include/opencv4/opencv2/core.hpp" ]]; then + if [[ -f "$P/include/openblas_config.h" ]]; then + OPENBLAS_PATH="$P" + elif [[ -f "$P/include/opencv4/opencv2/core.hpp" ]]; then OPENCV_PATH="$P" elif [[ -f "$P/include/caffe/caffe.hpp" ]]; then CAFFE_PATH="$P" @@ -31,6 +34,7 @@ if [[ -n "${BUILD_PATH:-}" ]]; then IFS="$PREVIFS" fi +OPENBLAS_PATH="${OPENBLAS_PATH//\\//}" OPENCV_PATH="${OPENCV_PATH//\\//}" CAFFE_PATH="${CAFFE_PATH//\\//}" @@ -40,7 +44,7 @@ tar --totals -xzf ../openpose-$OPENPOSE_VERSION.tar.gz INSTALL_PATH=`pwd` cd openpose-$OPENPOSE_VERSION -patch -Np1 < ../../../CMakeLists.patch +patch -Np1 < ../../../openpose.patch FLAGS="-DGPU_MODE=CPU_ONLY" if [[ "$EXTENSION" == *gpu ]]; then @@ -52,11 +56,9 @@ sedinplace '/find_package(GFlags)/d' CMakeLists.txt sedinplace '/find_package(Glog)/d' CMakeLists.txt sedinplace '/find_package(Protobuf REQUIRED/d' CMakeLists.txt -mkdir -p build && cd build - case $PLATFORM in linux-x86_64) - CC="gcc -m64" CXX="g++ -m64" $CMAKE \ + CC="gcc -m64 -I$OPENBLAS_PATH/include" CXX="g++ -m64 -I$OPENBLAS_PATH/include" $CMAKE \ -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH" \ -DCMAKE_INSTALL_LIBDIR="lib" \ -DGFLAGS_FOUND:BOOL=ON \ @@ -80,11 +82,42 @@ case $PLATFORM in -DUSE_MKL=OFF \ $FLAGS \ -DCUDA_HOST_COMPILER="$(which g++)" \ - .. + . + ;; + macosx-*) + CC="clang -I$OPENBLAS_PATH/include -undefined dynamic_lookup" CXX="clang++ -I$OPENBLAS_PATH/include -undefined dynamic_lookup" $CMAKE \ + -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH" \ + -DCMAKE_INSTALL_LIBDIR="lib" \ + -DGFLAGS_FOUND:BOOL=ON \ + -DGFLAGS_INCLUDE_DIR=$CAFFE_PATH/include \ + -DGLOG_FOUND:BOOL=ON \ + -DGLOG_INCLUDE_DIR=$CAFFE_PATH/include \ + -DOpenCV_INCLUDE_DIRS=$OPENCV_PATH/include \ + -DOpenCV_LIBS=$OPENCV_PATH/lib/libopencv_core.dylib \ + -DOpenCV_LIBS=$OPENCV_PATH/lib/libopencv_highgui.dylib \ + -DOpenCV_LIBS=$OPENCV_PATH/lib/libopencv_imgproc.dylib \ + -DOpenCV_LIBS=$OPENCV_PATH/lib/libopencv_imgcodecs.dylib \ + -DCaffe_INCLUDE_DIRS=$CAFFE_PATH/include \ + -DCaffe_LIBS_RELEASE=$CAFFE_PATH/lib/libcaffe.so \ + -DCaffe_LIBS=$CAFFE_PATH/lib/libcaffe.so \ + -DProtobuf_INCLUDE_DIRS=$CAFFE_PATH/include \ + -DDOWNLOAD_BODY_25_MODEL=OFF \ + -DDOWNLOAD_FACE_MODEL=OFF \ + -DDOWNLOAD_HAND_MODEL=OFF \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_CAFFE=OFF \ + -DUSE_MKL=OFF \ + $FLAGS \ + -DCUDA_HOST_COMPILER="$(which clang++)" \ + . + ;; + *) + echo "Error: Platform \"$PLATFORM\" is not supported" + return 0 ;; esac -make +make -j $MAKEJ make install cd ../../.. diff --git a/openpose/CMakeLists.patch b/openpose/openpose.patch similarity index 74% rename from openpose/CMakeLists.patch rename to openpose/openpose.patch index 95c3f2215dd..b12a805e33c 100644 --- a/openpose/CMakeLists.patch +++ b/openpose/openpose.patch @@ -2,15 +2,6 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e269073..d0d4265d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -220,6 +220,8 @@ if (${GPU_MODE} MATCHES "OPENCL") - find_package(OpenCL) - endif (${GPU_MODE} MATCHES "OPENCL") - -+find_package(Boost COMPONENTS system filesystem REQUIRED) -+ - # Code to avoid crash at compiling time if OpenCL is not found - if (NOT OpenCL_FOUND) - set(OpenCL_LIBRARIES "") @@ -786,6 +788,7 @@ if (UNIX OR APPLE) PREFIX ${CAFFE_PREFIX} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= diff --git a/openpose/platform/pom.xml b/openpose/platform/pom.xml index 5c67af6634d..ce62a249a6b 100644 --- a/openpose/platform/pom.xml +++ b/openpose/platform/pom.xml @@ -20,6 +20,11 @@ + + org.bytedeco + caffe-platform + 1.0-${project.parent.version} + ${project.groupId} ${javacpp.moduleId} @@ -31,6 +36,12 @@ ${project.version} ${javacpp.platform.linux-x86_64} + + ${project.groupId} + ${javacpp.moduleId} + ${project.version} + ${javacpp.platform.macosx-x86_64} + @@ -43,7 +54,7 @@ - ${javacpp.moduleId}.jar ${javacpp.moduleId}-linux-x86_64.jar + ${javacpp.moduleId}.jar ${javacpp.moduleId}-linux-x86_64.jar ${javacpp.moduleId}-macosx-x86_64.jar @@ -89,6 +100,7 @@ module org.bytedeco.${javacpp.moduleId}.platform { requires org.bytedeco.${javacpp.moduleId}.linux.x86_64; + requires org.bytedeco.${javacpp.moduleId}.macosx.x86_64; } diff --git a/openpose/pom.xml b/openpose/pom.xml index 1d68337db69..5b23b823a1d 100644 --- a/openpose/pom.xml +++ b/openpose/pom.xml @@ -42,7 +42,7 @@ org.bytedeco openblas - 0.3.9-${project.parent.version} + 0.3.10-${project.parent.version} org.bytedeco @@ -80,7 +80,7 @@ org.bytedeco openblas - 0.3.9-${project.parent.version} + 0.3.10-${project.parent.version} org.bytedeco @@ -103,7 +103,7 @@ org.bytedeco openblas - 0.3.9-${project.parent.version} + 0.3.10-${project.parent.version} ${javacpp.platform} @@ -133,6 +133,7 @@ ${basedir}/cppbuild/${javacpp.platform}${javacpp.platform.extension}/include/ + ${basedir}/../caffe/cppbuild/${javacpp.platform}/lib/ ${basedir}/../opencv/cppbuild/${javacpp.platform}/lib/ ${basedir}/../hdf5/cppbuild/${javacpp.platform}/lib/ ${basedir}/../openblas/cppbuild/${javacpp.platform}/lib/ diff --git a/openpose/samples/pom.xml b/openpose/samples/pom.xml new file mode 100644 index 00000000000..52263b548b5 --- /dev/null +++ b/openpose/samples/pom.xml @@ -0,0 +1,19 @@ + + 4.0.0 + org.bytedeco.openpose + openpose + 1.5.4-SNAPSHOT + + openpose + + + + org.bytedeco + openpose-platform + 1.6.0-1.5.4-SNAPSHOT + + + + . + + diff --git a/openpose/src/gen/java/org/bytedeco/openpose/Datum.java b/openpose/src/gen/java/org/bytedeco/openpose/Datum.java new file mode 100644 index 00000000000..f097cb0bc1d --- /dev/null +++ b/openpose/src/gen/java/org/bytedeco/openpose/Datum.java @@ -0,0 +1,385 @@ +// Targeted by JavaCPP version 1.5.4-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.openpose; + +import org.bytedeco.javacpp.annotation.Index; +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import static org.bytedeco.openblas.global.openblas_nolapack.*; +import static org.bytedeco.openblas.global.openblas.*; +import org.bytedeco.opencv.opencv_core.*; +import static org.bytedeco.opencv.global.opencv_core.*; +import org.bytedeco.opencv.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgcodecs.*; +import org.bytedeco.opencv.opencv_videoio.*; +import static org.bytedeco.opencv.global.opencv_videoio.*; +import org.bytedeco.opencv.opencv_highgui.*; +import static org.bytedeco.opencv.global.opencv_highgui.*; +import org.bytedeco.hdf5.*; +import static org.bytedeco.hdf5.global.hdf5.*; +import org.bytedeco.caffe.*; +import static org.bytedeco.caffe.global.caffe.*; + +import static org.bytedeco.openpose.global.openpose.*; + + /** + * Datum: The OpenPose Basic Piece of Information Between Threads + * Datum is one the main OpenPose classes/structs. The workers and threads share by default a + * std::shared_ptr>. It contains all the parameters that the different workers and threads need + * to exchange. + */ + @Namespace("op") @NoOffset @Properties(inherit = org.bytedeco.openpose.presets.openpose.class) +public class Datum extends Pointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public Datum(Pointer p) { super(p); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public Datum(long size) { super((Pointer)null); allocateArray(size); } + private native void allocateArray(long size); + @Override public Datum position(long position) { + return (Datum)super.position(position); + } + + // ---------------------------------------- ID parameters ---------------------------------------- // + /** Datum ID. Internally used to sort the Datums if multi-threading is used. */ + public native @Cast("unsigned long long") long id(); public native Datum id(long setter); + + /** Datum sub-ID. Internally used to sort the Datums if multi-threading is used. */ + public native @Cast("unsigned long long") long subId(); public native Datum subId(long setter); + + /** Datum maximum sub-ID. Used to sort the Datums if multi-threading is used. */ + public native @Cast("unsigned long long") long subIdMax(); public native Datum subIdMax(long setter); + + /** + * Name used when saving the data to disk (e.g., {@code write_images} or {@code write_keypoint} flags in the demo). + */ + public native @StdString BytePointer name(); public native Datum name(BytePointer setter); + + /** + * Corresponding frame number. + * If the producer (e.g., video) starts from frame 0 and does not repeat any frame, then frameNumber should + * match the field id. + */ + public native @Cast("unsigned long long") long frameNumber(); public native Datum frameNumber(long setter); + + // ------------------------------ Input image and rendered version parameters ------------------------------ // + /** + * Original image to be processed in cv::Mat uchar format. + * Size: (input_width x input_height) x 3 channels + */ + public native @ByRef Matrix cvInputData(); public native Datum cvInputData(Matrix setter); + + /** + * Original image to be processed in Array format. + * It has been resized to the net input resolution, as well as reformatted Array format to be compatible + * with the net. + * If >1 scales, each scale is right- and bottom-padded to fill the greatest resolution. The + * scales are sorted from bigger to smaller. + * Vector size: #scales + * Each array size: 3 x input_net_height x input_net_width + */ + public native @StdVector FloatArray inputNetData(); public native Datum inputNetData(FloatArray setter); + + /** + * Rendered image in Array format. + * It consists of a blending of the cvInputData and the pose/body part(s) heatmap/PAF(s). + * If rendering is disabled (e.g., {@code no_render_pose} flag in the demo), outputData will be empty. + * Size: 3 x output_net_height x output_net_width + */ + public native @ByRef FloatArray outputData(); public native Datum outputData(FloatArray setter); + + /** + * Rendered image in cv::Mat uchar format. + * It has been resized to the desired output resolution (e.g., {@code resolution} flag in the demo). + * If outputData is empty, cvOutputData will also be empty. + * Size: (output_height x output_width) x 3 channels + */ + public native @ByRef Matrix cvOutputData(); public native Datum cvOutputData(Matrix setter); + + /** + * Rendered 3D image in cv::Mat uchar format. + */ + public native @ByRef Matrix cvOutputData3D(); public native Datum cvOutputData3D(Matrix setter); + + // ------------------------------ Resulting Array data parameters ------------------------------ // + /** + * Body pose (x,y,score) locations for each person in the image. + * It has been resized to the desired output resolution (e.g., {@code resolution} flag in the demo). + * Size: #people x #body parts (e.g., 18 for COCO or 15 for MPI) x 3 ((x,y) coordinates + score) + */ + public native @ByRef FloatArray poseKeypoints(); public native Datum poseKeypoints(FloatArray setter); + + /** + * People ID + * It returns a person ID for each body pose, providing temporal consistency. The ID will be the same one + * for a person across frames. I.e. this ID allows to keep track of the same person in time. + * If either person identification is disabled or poseKeypoints is empty, poseIds will also be empty. + * Size: #people + */ + public native @ByRef LongLongArray poseIds(); public native Datum poseIds(LongLongArray setter); + + /** + * Body pose global confidence/score for each person in the image. + * It does not only consider the score of each body keypoint, but also the score of each PAF association. + * Optimized for COCO evaluation metric. + * It will highly penalyze people with missing body parts (e.g., cropped people on the borders of the image). + * If poseKeypoints is empty, poseScores will also be empty. + * Size: #people + */ + public native @ByRef FloatArray poseScores(); public native Datum poseScores(FloatArray setter); + + /** + * Body pose heatmaps (body parts, background and/or PAFs) for the whole image. + * This parameter is by default empty and disabled for performance. Each group (body parts, background and + * PAFs) can be individually enabled. + * #heatmaps = #body parts (if enabled) + 1 (if background enabled) + 2 x #PAFs (if enabled). Each PAF has 2 + * consecutive channels, one for x- and one for y-coordinates. + * Order heatmaps: body parts + background (as appears in POSE_BODY_PART_MAPPING) + (x,y) channel of each PAF + * (sorted as appears in POSE_BODY_PART_PAIRS). See {@code pose/poseParameters.hpp}. + * The user can choose the heatmaps normalization: ranges [0, 1], [-1, 1] or [0, 255]. Check the + * {@code heatmaps_scale} flag in {OpenPose_path}doc/demo_overview.md for more details. + * Size: #heatmaps x output_net_height x output_net_width + */ + public native @ByRef FloatArray poseHeatMaps(); public native Datum poseHeatMaps(FloatArray setter); + + /** + * Body pose candidates for the whole image. + * This parameter is by default empty and disabled for performance. It can be enabled with {@code candidates_body}. + * Candidates refer to all the detected body parts, before being assembled into people. Note that the number + * of candidates is equal or higher than the number of body parts after being assembled into people. + * Size: #body parts x min(part candidates, POSE_MAX_PEOPLE) x 3 (x,y,score). + * Rather than vector, it should ideally be: + * std::array>, #BP> poseCandidates; + */ + public native @StdVector Float3Vector poseCandidates(); public native Datum poseCandidates(Float3Vector setter); + + /** + * Face detection locations (x,y,width,height) for each person in the image. + * It is resized to cvInputData.size(). + * Size: #people + */ + public native @StdVector FloatRectangle faceRectangles(); public native Datum faceRectangles(FloatRectangle setter); + + /** + * Face keypoints (x,y,score) locations for each person in the image. + * It has been resized to the same resolution as {@code poseKeypoints}. + * Size: #people x #face parts (70) x 3 ((x,y) coordinates + score) + */ + public native @ByRef FloatArray faceKeypoints(); public native Datum faceKeypoints(FloatArray setter); + + /** + * Face pose heatmaps (face parts and/or background) for the whole image. + * Analogous of bodyHeatMaps applied to face. However, there is no PAFs and the size is different. + * Size: #people x #face parts (70) x output_net_height x output_net_width + */ + public native @ByRef FloatArray faceHeatMaps(); public native Datum faceHeatMaps(FloatArray setter); + + /** + * Hand detection locations (x,y,width,height) for each person in the image. + * It is resized to cvInputData.size(). + * Size: #people + */ + public native @StdVector FloatRectangle2 handRectangles(); public native Datum handRectangles(FloatRectangle2 setter); + + /** + * Hand keypoints (x,y,score) locations for each person in the image. + * It has been resized to the same resolution as {@code poseKeypoints}. + * handKeypoints[0] corresponds to left hands, and handKeypoints[1] to right ones. + * Size each Array: #people x #hand parts (21) x 3 ((x,y) coordinates + score) + */ + public native @ByRef FloatArray2 handKeypoints(); public native Datum handKeypoints(FloatArray2 setter); + + /** + * Hand pose heatmaps (hand parts and/or background) for the whole image. + * Analogous of faceHeatMaps applied to face. + * Size each Array: #people x #hand parts (21) x output_net_height x output_net_width + */ + public native @ByRef FloatArray2 handHeatMaps(); public native Datum handHeatMaps(FloatArray2 setter); + + // ---------------------------------------- 3-D Reconstruction parameters ---------------------------------------- // + /** + * Body pose (x,y,z,score) locations for each person in the image. + * Size: #people x #body parts (e.g., 18 for COCO or 15 for MPI) x 4 ((x,y,z) coordinates + score) + */ + public native @ByRef FloatArray poseKeypoints3D(); public native Datum poseKeypoints3D(FloatArray setter); + + /** + * Face keypoints (x,y,z,score) locations for each person in the image. + * It has been resized to the same resolution as {@code poseKeypoints3D}. + * Size: #people x #face parts (70) x 4 ((x,y,z) coordinates + score) + */ + public native @ByRef FloatArray faceKeypoints3D(); public native Datum faceKeypoints3D(FloatArray setter); + + /** + * Hand keypoints (x,y,z,score) locations for each person in the image. + * It has been resized to the same resolution as {@code poseKeypoints3D}. + * handKeypoints[0] corresponds to left hands, and handKeypoints[1] to right ones. + * Size each Array: #people x #hand parts (21) x 4 ((x,y,z) coordinates + score) + */ + public native @ByRef FloatArray2 handKeypoints3D(); public native Datum handKeypoints3D(FloatArray2 setter); + + /** + * 3x4 camera matrix of the camera (equivalent to cameraIntrinsics * cameraExtrinsics). + */ + public native @ByRef Matrix cameraMatrix(); public native Datum cameraMatrix(Matrix setter); + + /** + * 3x4 extrinsic parameters of the camera. + */ + public native @ByRef Matrix cameraExtrinsics(); public native Datum cameraExtrinsics(Matrix setter); + + /** + * 3x3 intrinsic parameters of the camera. + */ + public native @ByRef Matrix cameraIntrinsics(); public native Datum cameraIntrinsics(Matrix setter); + + /** + * If it is not empty, OpenPose will not run its internal body pose estimation network and will instead use + * this data as the substitute of its network. The size of this element must match the size of the output of + * its internal network, or it will lead to core dumped (segmentation) errors. You can modify the pose + * estimation flags to match the dimension of both elements (e.g., {@code --net_resolution}, {@code --scale_number}, etc.). + */ + public native @ByRef FloatArray poseNetOutput(); public native Datum poseNetOutput(FloatArray setter); + + // ---------------------------------------- Other (internal) parameters ---------------------------------------- // + /** + * Scale ratio between the input Datum::cvInputData and the net input size. + */ + public native @StdVector DoublePointer scaleInputToNetInputs(); public native Datum scaleInputToNetInputs(DoublePointer setter); + + /** + * Size(s) (width x height) of the image(s) fed to the pose deep net. + * The size of the std::vector corresponds to the number of scales. + */ + public native @StdVector IntPoint netInputSizes(); public native Datum netInputSizes(IntPoint setter); + + /** + * Scale ratio between the input Datum::cvInputData and the output Datum::cvOutputData. + */ + public native double scaleInputToOutput(); public native Datum scaleInputToOutput(double setter); + + /** + * Size (width x height) of the image returned by the deep net. + */ + public native @ByRef IntPoint netOutputSize(); public native Datum netOutputSize(IntPoint setter); + + /** + * Scale ratio between the net output and the final output Datum::cvOutputData. + */ + public native double scaleNetToOutput(); public native Datum scaleNetToOutput(double setter); + + /** + * Pair with the element key id POSE_BODY_PART_MAPPING on {@code pose/poseParameters.hpp} and its mapped value (e.g. + * 1 and "Neck"). + */ + public native @ByRef IntStringPair elementRendered(); public native Datum elementRendered(IntStringPair setter); + + // 3D/Adam parameters (experimental code not meant to be publicly used) +// #ifdef USE_3D_ADAM_MODEL +// #endif + + + + + + // ---------------------------------------- Functions ---------------------------------------- // + /** + * Default constructor struct. + * It simply initializes the struct, id is temporary set to 0 and each other variable is assigned to its + * default value. + */ + public Datum() { super((Pointer)null); allocate(); } + private native void allocate(); + + /** + * Copy constructor. + * It performs {@code fast copy}: For performance purpose, copying a Datum or Array or cv::Mat just copies the + * reference, it still shares the same internal data. + * Modifying the copied element will modify the original one. + * Use clone() for a slower but real copy, similarly to cv::Mat and Array. + * @param datum Datum to be copied. + */ + public Datum(@Const @ByRef Datum datum) { super((Pointer)null); allocate(datum); } + private native void allocate(@Const @ByRef Datum datum); + + /** + * Copy assignment. + * Similar to Datum::Datum(const Datum& datum). + * @param datum Datum to be copied. + * @return The resulting Datum. + */ + public native @ByRef @Name("operator =") Datum put(@Const @ByRef Datum datum); + + /** + * Move constructor. + * It destroys the original Datum to be moved. + * @param datum Datum to be moved. + */ + + /** + * Move assignment. + * Similar to Datum::Datum(Datum&& datum). + * @param datum Datum to be moved. + * @return The resulting Datum. + */ + + /** + * Destructor class. + * Declared virtual so that Datum can be inherited. + */ + + /** + * Clone function. + * Similar to cv::Mat::clone and Array::clone. + * It performs a real but slow copy of the data, i.e., even if the copied element is modified, the original + * one is not. + * @return The resulting Datum. + */ + public native @ByVal Datum clone(); + + + + + + // ---------------------------------------- Comparison operators ---------------------------------------- // + /** + * Less comparison operator. + * @param datum Datum to be compared. + * @return Whether the instance satisfies the condition with respect to datum. + */ + public native @Cast("bool") @Name("operator <") boolean lessThan(@Const @ByRef Datum datum); + /** + * Greater comparison operator. + * @param datum Datum to be compared. + * @return Whether the instance satisfies the condition with respect to datum. + */ + public native @Cast("bool") @Name("operator >") boolean greaterThan(@Const @ByRef Datum datum); + /** + * Less or equal comparison operator. + * @param datum Datum to be compared. + * @return Whether the instance satisfies the condition with respect to datum. + */ + public native @Cast("bool") @Name("operator <=") boolean lessThanEquals(@Const @ByRef Datum datum); + /** + * Greater or equal comparison operator. + * @param datum Datum to be compared. + * @return Whether the instance satisfies the condition with respect to datum. + */ + public native @Cast("bool") @Name("operator >=") boolean greaterThanEquals(@Const @ByRef Datum datum); + /** + * Equal comparison operator. + * @param datum Datum to be compared. + * @return Whether the instance satisfies the condition with respect to datum. + */ + public native @Cast("bool") @Name("operator ==") boolean equals(@Const @ByRef Datum datum); + /** + * Not equal comparison operator. + * @param datum Datum to be compared. + * @return Whether the instance satisfies the condition with respect to datum. + */ + public native @Cast("bool") @Name("operator !=") boolean notEquals(@Const @ByRef Datum datum); + } diff --git a/openpose/src/gen/java/org/bytedeco/openpose/Datums.java b/openpose/src/gen/java/org/bytedeco/openpose/Datums.java new file mode 100644 index 00000000000..5d76430c2d2 --- /dev/null +++ b/openpose/src/gen/java/org/bytedeco/openpose/Datums.java @@ -0,0 +1,97 @@ +// Targeted by JavaCPP version 1.5.4-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.openpose; + +import org.bytedeco.javacpp.annotation.Index; +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import static org.bytedeco.openblas.global.openblas_nolapack.*; +import static org.bytedeco.openblas.global.openblas.*; +import org.bytedeco.opencv.opencv_core.*; +import static org.bytedeco.opencv.global.opencv_core.*; +import org.bytedeco.opencv.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgcodecs.*; +import org.bytedeco.opencv.opencv_videoio.*; +import static org.bytedeco.opencv.global.opencv_videoio.*; +import org.bytedeco.opencv.opencv_highgui.*; +import static org.bytedeco.opencv.global.opencv_highgui.*; +import org.bytedeco.hdf5.*; +import static org.bytedeco.hdf5.global.hdf5.*; +import org.bytedeco.caffe.*; +import static org.bytedeco.caffe.global.caffe.*; + +import static org.bytedeco.openpose.global.openpose.*; + +@Name("std::vector >") @Properties(inherit = org.bytedeco.openpose.presets.openpose.class) +public class Datums extends Pointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public Datums(Pointer p) { super(p); } + public Datums(Datum value) { this(1); put(0, value); } + public Datums(Datum ... array) { this(array.length); put(array); } + public Datums() { allocate(); } + public Datums(long n) { allocate(n); } + private native void allocate(); + private native void allocate(@Cast("size_t") long n); + public native @Name("operator =") @ByRef Datums put(@ByRef Datums x); + + public boolean empty() { return size() == 0; } + public native long size(); + public void clear() { resize(0); } + public native void resize(@Cast("size_t") long n); + + @Index(function = "at") public native @SharedPtr Datum get(@Cast("size_t") long i); + public native Datums put(@Cast("size_t") long i, Datum value); + + public native @ByVal Iterator insert(@ByVal Iterator pos, @SharedPtr Datum value); + public native @ByVal Iterator erase(@ByVal Iterator pos); + public native @ByVal Iterator begin(); + public native @ByVal Iterator end(); + @NoOffset @Name("iterator") public static class Iterator extends Pointer { + public Iterator(Pointer p) { super(p); } + public Iterator() { } + + public native @Name("operator ++") @ByRef Iterator increment(); + public native @Name("operator ==") boolean equals(@ByRef Iterator it); + public native @Name("operator *") @SharedPtr @Const Datum get(); + } + + public Datum[] get() { + Datum[] array = new Datum[size() < Integer.MAX_VALUE ? (int)size() : Integer.MAX_VALUE]; + for (int i = 0; i < array.length; i++) { + array[i] = get(i); + } + return array; + } + @Override public String toString() { + return java.util.Arrays.toString(get()); + } + + public Datum pop_back() { + long size = size(); + Datum value = get(size - 1); + resize(size - 1); + return value; + } + public Datums push_back(Datum value) { + long size = size(); + resize(size + 1); + return put(size, value); + } + public Datums put(Datum value) { + if (size() != 1) { resize(1); } + return put(0, value); + } + public Datums put(Datum ... array) { + if (size() != array.length) { resize(array.length); } + for (int i = 0; i < array.length; i++) { + put(i, array[i]); + } + return this; + } +} + diff --git a/openpose/src/gen/java/org/bytedeco/openpose/DatumsWorker.java b/openpose/src/gen/java/org/bytedeco/openpose/DatumsWorker.java new file mode 100644 index 00000000000..11b1678cf13 --- /dev/null +++ b/openpose/src/gen/java/org/bytedeco/openpose/DatumsWorker.java @@ -0,0 +1,47 @@ +// Targeted by JavaCPP version 1.5.4-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.openpose; + +import org.bytedeco.javacpp.annotation.Index; +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import static org.bytedeco.openblas.global.openblas_nolapack.*; +import static org.bytedeco.openblas.global.openblas.*; +import org.bytedeco.opencv.opencv_core.*; +import static org.bytedeco.opencv.global.opencv_core.*; +import org.bytedeco.opencv.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgcodecs.*; +import org.bytedeco.opencv.opencv_videoio.*; +import static org.bytedeco.opencv.global.opencv_videoio.*; +import org.bytedeco.opencv.opencv_highgui.*; +import static org.bytedeco.opencv.global.opencv_highgui.*; +import org.bytedeco.hdf5.*; +import static org.bytedeco.hdf5.global.hdf5.*; +import org.bytedeco.caffe.*; +import static org.bytedeco.caffe.global.caffe.*; + +import static org.bytedeco.openpose.global.openpose.*; + + @Name("op::Worker > > >") @NoOffset @Properties(inherit = org.bytedeco.openpose.presets.openpose.class) +public class DatumsWorker extends Pointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public DatumsWorker(Pointer p) { super(p); } + + + public native void initializationOnThreadNoException(); + + public native @Cast("bool") boolean checkAndWork(@SharedPtr @ByRef Datums tDatums); + + public native @Cast("bool") boolean isRunning(); + + public native void stop(); + + // Virtual in case some function needs spetial stopping (e.g., buffers might not stop inmediately and need a + // few iterations) + public native void tryStop(); + } diff --git a/openpose/src/gen/java/org/bytedeco/openpose/Float3.java b/openpose/src/gen/java/org/bytedeco/openpose/Float3.java new file mode 100644 index 00000000000..8fe3f90a338 --- /dev/null +++ b/openpose/src/gen/java/org/bytedeco/openpose/Float3.java @@ -0,0 +1,44 @@ +// Targeted by JavaCPP version 1.5.4-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.openpose; + +import org.bytedeco.javacpp.annotation.Index; +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import static org.bytedeco.openblas.global.openblas_nolapack.*; +import static org.bytedeco.openblas.global.openblas.*; +import org.bytedeco.opencv.opencv_core.*; +import static org.bytedeco.opencv.global.opencv_core.*; +import org.bytedeco.opencv.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgcodecs.*; +import org.bytedeco.opencv.opencv_videoio.*; +import static org.bytedeco.opencv.global.opencv_videoio.*; +import org.bytedeco.opencv.opencv_highgui.*; +import static org.bytedeco.opencv.global.opencv_highgui.*; +import org.bytedeco.hdf5.*; +import static org.bytedeco.hdf5.global.hdf5.*; +import org.bytedeco.caffe.*; +import static org.bytedeco.caffe.global.caffe.*; + +import static org.bytedeco.openpose.global.openpose.*; + +@Name("std::array") @Properties(inherit = org.bytedeco.openpose.presets.openpose.class) +public class Float3 extends Pointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public Float3(Pointer p) { super(p); } + public Float3() { allocate(); } + private native void allocate(); + public native @Name("operator =") @ByRef Float3 put(@ByRef Float3 x); + + public boolean empty() { return size() == 0; } + public native long size(); + + @Index public native float get(@Cast("size_t") long i); + public native Float3 put(@Cast("size_t") long i, float value); +} + diff --git a/openpose/src/gen/java/org/bytedeco/openpose/Float3Vector.java b/openpose/src/gen/java/org/bytedeco/openpose/Float3Vector.java new file mode 100644 index 00000000000..86ffae298b5 --- /dev/null +++ b/openpose/src/gen/java/org/bytedeco/openpose/Float3Vector.java @@ -0,0 +1,97 @@ +// Targeted by JavaCPP version 1.5.4-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.openpose; + +import org.bytedeco.javacpp.annotation.Index; +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import static org.bytedeco.openblas.global.openblas_nolapack.*; +import static org.bytedeco.openblas.global.openblas.*; +import org.bytedeco.opencv.opencv_core.*; +import static org.bytedeco.opencv.global.opencv_core.*; +import org.bytedeco.opencv.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgcodecs.*; +import org.bytedeco.opencv.opencv_videoio.*; +import static org.bytedeco.opencv.global.opencv_videoio.*; +import org.bytedeco.opencv.opencv_highgui.*; +import static org.bytedeco.opencv.global.opencv_highgui.*; +import org.bytedeco.hdf5.*; +import static org.bytedeco.hdf5.global.hdf5.*; +import org.bytedeco.caffe.*; +import static org.bytedeco.caffe.global.caffe.*; + +import static org.bytedeco.openpose.global.openpose.*; + +@Name("std::vector >") @Properties(inherit = org.bytedeco.openpose.presets.openpose.class) +public class Float3Vector extends Pointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public Float3Vector(Pointer p) { super(p); } + public Float3Vector(Float3 value) { this(1); put(0, value); } + public Float3Vector(Float3 ... array) { this(array.length); put(array); } + public Float3Vector() { allocate(); } + public Float3Vector(long n) { allocate(n); } + private native void allocate(); + private native void allocate(@Cast("size_t") long n); + public native @Name("operator =") @ByRef Float3Vector put(@ByRef Float3Vector x); + + public boolean empty() { return size() == 0; } + public native long size(); + public void clear() { resize(0); } + public native void resize(@Cast("size_t") long n); + + @Index(function = "at") public native @ByRef Float3 get(@Cast("size_t") long i); + public native Float3Vector put(@Cast("size_t") long i, Float3 value); + + public native @ByVal Iterator insert(@ByVal Iterator pos, @ByRef Float3 value); + public native @ByVal Iterator erase(@ByVal Iterator pos); + public native @ByVal Iterator begin(); + public native @ByVal Iterator end(); + @NoOffset @Name("iterator") public static class Iterator extends Pointer { + public Iterator(Pointer p) { super(p); } + public Iterator() { } + + public native @Name("operator ++") @ByRef Iterator increment(); + public native @Name("operator ==") boolean equals(@ByRef Iterator it); + public native @Name("operator *") @ByRef @Const Float3 get(); + } + + public Float3[] get() { + Float3[] array = new Float3[size() < Integer.MAX_VALUE ? (int)size() : Integer.MAX_VALUE]; + for (int i = 0; i < array.length; i++) { + array[i] = get(i); + } + return array; + } + @Override public String toString() { + return java.util.Arrays.toString(get()); + } + + public Float3 pop_back() { + long size = size(); + Float3 value = get(size - 1); + resize(size - 1); + return value; + } + public Float3Vector push_back(Float3 value) { + long size = size(); + resize(size + 1); + return put(size, value); + } + public Float3Vector put(Float3 value) { + if (size() != 1) { resize(1); } + return put(0, value); + } + public Float3Vector put(Float3 ... array) { + if (size() != array.length) { resize(array.length); } + for (int i = 0; i < array.length; i++) { + put(i, array[i]); + } + return this; + } +} + diff --git a/openpose/src/gen/java/org/bytedeco/openpose/FloatArray.java b/openpose/src/gen/java/org/bytedeco/openpose/FloatArray.java new file mode 100644 index 00000000000..4d323af346c --- /dev/null +++ b/openpose/src/gen/java/org/bytedeco/openpose/FloatArray.java @@ -0,0 +1,463 @@ +// Targeted by JavaCPP version 1.5.4-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.openpose; + +import org.bytedeco.javacpp.annotation.Index; +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import static org.bytedeco.openblas.global.openblas_nolapack.*; +import static org.bytedeco.openblas.global.openblas.*; +import org.bytedeco.opencv.opencv_core.*; +import static org.bytedeco.opencv.global.opencv_core.*; +import org.bytedeco.opencv.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgcodecs.*; +import org.bytedeco.opencv.opencv_videoio.*; +import static org.bytedeco.opencv.global.opencv_videoio.*; +import org.bytedeco.opencv.opencv_highgui.*; +import static org.bytedeco.opencv.global.opencv_highgui.*; +import org.bytedeco.hdf5.*; +import static org.bytedeco.hdf5.global.hdf5.*; +import org.bytedeco.caffe.*; +import static org.bytedeco.caffe.global.caffe.*; + +import static org.bytedeco.openpose.global.openpose.*; + + /** + * Array: The OpenPose Basic Raw Data Container + * This template class implements a multidimensional data array. It is our basic data container, analogous to + * Mat in OpenCV, Tensor in Torch/TensorFlow or Blob in Caffe. + * It wraps a Matrix and a std::shared_ptr, both of them pointing to the same raw data. I.e. they both share the + * same memory, so we can read and modify this data in both formats with no performance impact. + * Hence, it keeps high performance while adding high-level functions. + */ + @Name("op::Array") @NoOffset @Properties(inherit = org.bytedeco.openpose.presets.openpose.class) +public class FloatArray extends Pointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public FloatArray(Pointer p) { super(p); } + + // ------------------------------ Constructors and Data Allocator Functions ------------------------------ // + /** + * Array constructor. + * Equivalent to default constructor + reset(const int size). + * @param size Integer with the number of T element to be allocated. E.g., size = 5 is internally similar to + * {@code new T[5]}. + */ + public FloatArray(int size) { super((Pointer)null); allocate(size); } + private native void allocate(int size); + + /** + * Array constructor. + * Equivalent to default constructor + reset(const std::vector& size = {}). + * @param sizes Vector with the size of each dimension. E.g., size = {3, 5, 2} is internally similar to + * {@code new T[3*5*2]}. + */ + public FloatArray(@StdVector IntPointer sizes/*={}*/) { super((Pointer)null); allocate(sizes); } + private native void allocate(@StdVector IntPointer sizes/*={}*/); + public FloatArray() { super((Pointer)null); allocate(); } + private native void allocate(); + public FloatArray(@StdVector IntBuffer sizes/*={}*/) { super((Pointer)null); allocate(sizes); } + private native void allocate(@StdVector IntBuffer sizes/*={}*/); + public FloatArray(@StdVector int[] sizes/*={}*/) { super((Pointer)null); allocate(sizes); } + private native void allocate(@StdVector int[] sizes/*={}*/); + + /** + * Array constructor. + * Equivalent to default constructor + reset(const int size, const T value). + * @param size Integer with the number of T element to be allocated. E.g., size = 5 is internally similar to + * {@code new T[5]}. + * @param value Initial value for each component of the Array. + */ + public FloatArray(int size, float value) { super((Pointer)null); allocate(size, value); } + private native void allocate(int size, float value); + + /** + * Array constructor. + * Equivalent to default constructor + reset(const std::vector& size, const T value). + * @param sizes Vector with the size of each dimension. E.g., size = {3, 5, 2} is internally similar to: + * {@code new T[3*5*2]}. + * @param value Initial value for each component of the Array. + */ + public FloatArray(@StdVector IntPointer sizes, float value) { super((Pointer)null); allocate(sizes, value); } + private native void allocate(@StdVector IntPointer sizes, float value); + public FloatArray(@StdVector IntBuffer sizes, float value) { super((Pointer)null); allocate(sizes, value); } + private native void allocate(@StdVector IntBuffer sizes, float value); + public FloatArray(@StdVector int[] sizes, float value) { super((Pointer)null); allocate(sizes, value); } + private native void allocate(@StdVector int[] sizes, float value); + + /** + * Array constructor. + * Equivalent to default constructor, but it does not allocate memory, but rather use dataPtr. + * @param size Integer with the number of T element to be allocated. E.g., size = 5 is internally similar to + * {@code new T[5]}. + * @param dataPtr Pointer to the memory to be used by the Array. + */ + public FloatArray(int size, FloatPointer dataPtr) { super((Pointer)null); allocate(size, dataPtr); } + private native void allocate(int size, FloatPointer dataPtr); + public FloatArray(int size, FloatBuffer dataPtr) { super((Pointer)null); allocate(size, dataPtr); } + private native void allocate(int size, FloatBuffer dataPtr); + public FloatArray(int size, float[] dataPtr) { super((Pointer)null); allocate(size, dataPtr); } + private native void allocate(int size, float[] dataPtr); + + /** + * Array constructor. + * Equivalent to default constructor, but it does not allocate memory, but rather use dataPtr. + * @param sizes Vector with the size of each dimension. E.g., size = {3, 5, 2} is internally similar to: + * {@code new T[3*5*2]}. + * @param dataPtr Pointer to the memory to be used by the Array. + */ + public FloatArray(@StdVector IntPointer sizes, FloatPointer dataPtr) { super((Pointer)null); allocate(sizes, dataPtr); } + private native void allocate(@StdVector IntPointer sizes, FloatPointer dataPtr); + public FloatArray(@StdVector IntBuffer sizes, FloatBuffer dataPtr) { super((Pointer)null); allocate(sizes, dataPtr); } + private native void allocate(@StdVector IntBuffer sizes, FloatBuffer dataPtr); + public FloatArray(@StdVector int[] sizes, float[] dataPtr) { super((Pointer)null); allocate(sizes, dataPtr); } + private native void allocate(@StdVector int[] sizes, float[] dataPtr); + + /** + * Array constructor. + * @param array Array with the original data array to slice. + * @param index indicates the index of the array to extract. + * @param noCopy indicates whether to perform a copy. Copy will never go to undefined behavior, however, if + * noCopy == true, then: + * 1. It is faster, as no data copy is involved, but... + * 2. If the Array array goes out of scope, then the resulting Array will provoke an undefined behavior. + * 3. If the returned Array is modified, the information in the Array array will also be. + * @return Array with the same dimension than array expect the first dimension being 1. E.g., if array + * is {p,k,m}, the resulting Array is {1,k,m}. + */ + public FloatArray(@Const @ByRef FloatArray array, int index, @Cast("const bool") boolean noCopy/*=false*/) { super((Pointer)null); allocate(array, index, noCopy); } + private native void allocate(@Const @ByRef FloatArray array, int index, @Cast("const bool") boolean noCopy/*=false*/); + public FloatArray(@Const @ByRef FloatArray array, int index) { super((Pointer)null); allocate(array, index); } + private native void allocate(@Const @ByRef FloatArray array, int index); + + /** + * Array constructor. It manually copies the Array into the new Array + * @param array Array with a format T2 different to the current Array type T. + */ + + /** + * Copy constructor. + * It performs {@code fast copy}: For performance purpose, copying a Array or Datum or cv::Mat just copies the + * reference, it still shares the same internal data. + * Modifying the copied element will modify the original one. + * Use clone() for a slower but real copy, similarly to cv::Mat and Array. + * @param array Array to be copied. + */ + public FloatArray(@Const @ByRef FloatArray array) { super((Pointer)null); allocate(array); } + private native void allocate(@Const @ByRef FloatArray array); + + /** + * Copy assignment. + * Similar to Array(const Array& array). + * @param array Array to be copied. + * @return The resulting Array. + */ + public native @ByRef @Name("operator =") FloatArray put(@Const @ByRef FloatArray array); + + /** + * Move constructor. + * It destroys the original Array to be moved. + * @param array Array to be moved. + */ + + /** + * Move assignment. + * Similar to Array(Array&& array). + * @param array Array to be moved. + * @return The resulting Array. + */ + + /** + * Clone function. + * Similar to cv::Mat::clone and Datum::clone. + * It performs a real but slow copy of the data, i.e., even if the copied element is modified, the original + * one is not. + * @return The resulting Array. + */ + public native @ByVal FloatArray clone(); + + /** + * Data allocation function. + * It allocates the required space for the memory (it does not initialize that memory). + * @param size Integer with the number of T element to be allocated. E.g., size = 5 is internally similar to + * {@code new T[5]}. + */ + public native void reset(int size); + + /** + * Data allocation function. + * Similar to reset(const int size), but it allocates a multi-dimensional array of dimensions each of the + * values of the argument. + * @param sizes Vector with the size of each dimension. E.g., size = {3, 5, 2} is internally similar to + * {@code new T[3*5*2]}. + */ + public native void reset(@StdVector IntPointer sizes/*={}*/); + public native void reset(); + public native void reset(@StdVector IntBuffer sizes/*={}*/); + public native void reset(@StdVector int[] sizes/*={}*/); + + /** + * Data allocation function. + * Similar to reset(const int size), but initializing the data to the value specified by the second argument. + * @param size Integer with the number of T element to be allocated. E.g., size = 5 is internally similar to + * {@code new T[5]}. + * @param value Initial value for each component of the Array. + */ + public native void reset(int size, float value); + + /** + * Data allocation function. + * Similar to reset(const std::vector& size), but initializing the data to the value specified by the + * second argument. + * @param sizes Vector with the size of each dimension. E.g., size = {3, 5, 2} is internally similar to + * {@code new T[3*5*2]}. + * @param value Initial value for each component of the Array. + */ + public native void reset(@StdVector IntPointer sizes, float value); + public native void reset(@StdVector IntBuffer sizes, float value); + public native void reset(@StdVector int[] sizes, float value); + + /** + * Data allocation function. + * Equivalent to default constructor, but it does not allocate memory, but rather use dataPtr. + * @param size Integer with the number of T element to be allocated. E.g., size = 5 is internally similar to + * {@code new T[5]}. + * @param dataPtr Pointer to the memory to be used by the Array. + */ + public native void reset(int size, FloatPointer dataPtr); + public native void reset(int size, FloatBuffer dataPtr); + public native void reset(int size, float[] dataPtr); + + /** + * Data allocation function. + * Equivalent to default constructor, but it does not allocate memory, but rather use dataPtr. + * @param sizes Vector with the size of each dimension. E.g., size = {3, 5, 2} is internally similar to: + * {@code new T[3*5*2]}. + * @param dataPtr Pointer to the memory to be used by the Array. + */ + public native void reset(@StdVector IntPointer sizes, FloatPointer dataPtr); + public native void reset(@StdVector IntBuffer sizes, FloatBuffer dataPtr); + public native void reset(@StdVector int[] sizes, float[] dataPtr); + + /** + * Data allocation function. + * It internally allocates memory and copies the data of the argument to the Array allocated memory. + * @param cvMat Matrix to be copied. + */ + public native void setFrom(@Const @ByRef Matrix cvMat); + + /** + * Data allocation function. + * It internally assigns all the allocated memory to the value indicated by the argument. + * @param value Value for each component of the Array. + */ + public native void setTo(float value); + + + + // ------------------------------ Data Information Functions ------------------------------ // + /** + * Check whether memory has been allocated. + * @return True if no memory has been allocated, false otherwise. + */ + public native @Cast("bool") boolean empty(); + + /** + * Return a vector with the size of each dimension allocated. + * @return A std::vector with the size of each dimension. If no memory has been allocated, it will return + * an empty std::vector. + */ + public native @StdVector IntPointer getSize(); + + /** + * Return a vector with the size of the desired dimension. + * @param index Dimension to check its size. + * @return Size of the desired dimension. It will return 0 if the requested dimension is higher than the number + * of dimensions. + */ + public native int getSize(int index); + + /** + * Return a string with the size of each dimension allocated. + * @return A std::stringwith the size of each dimension. If no memory has been allocated, it will return an + * empty string. + */ + public native @StdString BytePointer printSize(); + + /** + * Return the total number of dimensions, equivalent to getSize().size(). + * @return The number of dimensions. If no memory is allocated, it returns 0. + */ + public native @Cast("size_t") long getNumberDimensions(); + + /** + * Return the total number of elements allocated, equivalent to multiply all the components from getSize(). + * E.g., for a Array of size = {2,5,3}, the volume or total number of elements is: 2x5x3 = 30. + * @return The total volume of the allocated data. If no memory is allocated, it returns 0. + */ + public native @Cast("size_t") long getVolume(); + + /** + * Similar to getVolume(), but in this case it just returns the volume between the desired dimensions. + * E.g., for a Array of size = {2,5,3}, the volume or total number of elements for getVolume(1,2) is + * 5x3 = 15. + * @param indexA Dimension where to start. + * @param indexB Dimension where to stop. If indexB == -1, then it will take up to the last dimension. + * @return The total volume of the allocated data between the desired dimensions. If the index are out of + * bounds, it throws an error. + */ + public native @Cast("size_t") long getVolume(int indexA, int indexB/*=-1*/); + public native @Cast("size_t") long getVolume(int indexA); + + /** + * Return the stride or step size of the array. + * E.g., given and Array of size 5x3, getStride() would return the following vector: + * {5x3sizeof(T), 3sizeof(T), sizeof(T)}. + */ + public native @StdVector IntPointer getStride(); + + /** + * Return the stride or step size of the array at the index-th dimension. + * E.g., given and Array of size 5x3, getStride(2) would return sizeof(T). + */ + public native int getStride(int index); + + + + // ------------------------------ Data Access Functions And Operators ------------------------------ // + /** + * Return a raw pointer to the data. Similar to: std::shared_ptr::get(). + * Note: if you modify the pointer data, you will directly modify it in the Array instance too. + * If you know you do not want to modify the data, then use getConstPtr() instead. + * @return A raw pointer to the data. + */ + public native FloatPointer getPtr(); + + /** + * Similar to getPtr(), but it forbids the data to be edited. + * @return A raw const pointer to the data. + */ + public native @Const FloatPointer getConstPtr(); + + /** + * Similar to getConstPtr(), but it allows the data to be edited. + * This function is only implemented for Pybind11 usage. + * @return A raw pointer to the data. + */ + public native FloatPointer getPseudoConstPtr(); + + /** + * Return a Matrix wrapper to the data. It forbids the data to be modified. + * OpenCV only admits unsigned char, signed char, int, float & double. If the T class is not supported by + * OpenCV, it will throw an error. + * Note: Array does not return an editable Matrix because some OpenCV functions reallocate memory and it + * would not longer point to the Array instance. + * If you want to perform some OpenCV operation on the Array data, you can use: + * editedCvMat = array.getConstCvMat().clone(); + * // modify data + * array.setFrom(editedCvMat) + * @return A const Matrix pointing to the data. + */ + public native @Const @ByRef Matrix getConstCvMat(); + + /** + * Analogous to getConstCvMat, but in this case it returns a editable Matrix. + * Very important: Only allowed functions which do not provoke data reallocation. + * E.g., resizing functions will not work and they would provoke an undefined behavior and/or execution + * crashes. + * @return A Matrix pointing to the data. + */ + public native @ByRef Matrix getCvMat(); + + /** + * [] operator + * Similar to the [] operator for raw pointer data. + * If debug mode is enabled, then it will check that the desired index is in the data range, and it will throw + * an exception otherwise (similar to the at operator). + * @param index The desired memory location. + * @return A editable reference to the data on the desired index location. + */ + public native @ByRef @Name("operator []") FloatPointer get(int index); + + /** + * [] operator + * Same functionality as operator[](const int index), but it forbids modifying the value. Otherwise, const + * functions would not be able to call the [] operator. + * @param index The desired memory location. + * @return A non-editable reference to the data on the desired index location. + */ + + /** + * [] operator + * Same functionality as operator[](const int index), but it lets the user introduce the multi-dimensional + * index. + * E.g., given a (10 x 10 x 10) array, array[11] is equivalent to array[{1,1,0}] + * @param indexes Vector with the desired memory location. + * @return A editable reference to the data on the desired index location. + */ + public native @ByRef @Name("operator []") FloatPointer get(@StdVector IntPointer indexes); + public native @ByRef @Name("operator []") FloatBuffer get(@StdVector IntBuffer indexes); + public native @ByRef @Name("operator []") float[] get(@StdVector int[] indexes); + + /** + * [] operator + * Same functionality as operator[](const std::vector& indexes), but it forbids modifying the value. + * Otherwise, const functions would not be able to call the [] operator. + * @param indexes Vector with the desired memory location. + * @return A non-editable reference to the data on the desired index location. + */ + + /** + * at() function + * Same functionality as operator[](const int index), but it always check whether the indexes are within the + * data bounds. Otherwise, it will throw an error. + * @param index The desired memory location. + * @return A editable reference to the data on the desired index location. + */ + public native @ByRef FloatPointer at(int index); + + /** + * at() function + * Same functionality as operator[](const int index) const, but it always check whether the indexes are within + * the data bounds. Otherwise, it will throw an error. + * @param index The desired memory location. + * @return A non-editable reference to the data on the desired index location. + */ + + /** + * at() function + * Same functionality as operator[](const std::vector& indexes), but it always check whether the indexes + * are within the data bounds. Otherwise, it will throw an error. + * @param indexes Vector with the desired memory location. + * @return A editable reference to the data on the desired index location. + */ + public native @ByRef FloatPointer at(@StdVector IntPointer indexes); + public native @ByRef FloatBuffer at(@StdVector IntBuffer indexes); + public native @ByRef float[] at(@StdVector int[] indexes); + + /** + * at() function + * Same functionality as operator[](const std::vector& indexes) const, but it always check whether the + * indexes are within the data bounds. Otherwise, it will throw an error. + * @param indexes Vector with the desired memory location. + * @return A non-editable reference to the data on the desired index location. + */ + + /** + * It returns a string with the whole array data. Useful for debugging. + * The format is: values separated by a space, and a enter for each dimension. E.g., + * For the Array{2, 2, 3}, it will print: + * Array::toString(): + * x1 x2 x3 + * x4 x5 x6 + * + * x7 x8 x9 + * x10 x11 x12 + * @return A string with the array values in the above format. + */ + + } diff --git a/openpose/src/gen/java/org/bytedeco/openpose/FloatArray2.java b/openpose/src/gen/java/org/bytedeco/openpose/FloatArray2.java new file mode 100644 index 00000000000..8caad9f287d --- /dev/null +++ b/openpose/src/gen/java/org/bytedeco/openpose/FloatArray2.java @@ -0,0 +1,44 @@ +// Targeted by JavaCPP version 1.5.4-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.openpose; + +import org.bytedeco.javacpp.annotation.Index; +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import static org.bytedeco.openblas.global.openblas_nolapack.*; +import static org.bytedeco.openblas.global.openblas.*; +import org.bytedeco.opencv.opencv_core.*; +import static org.bytedeco.opencv.global.opencv_core.*; +import org.bytedeco.opencv.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgcodecs.*; +import org.bytedeco.opencv.opencv_videoio.*; +import static org.bytedeco.opencv.global.opencv_videoio.*; +import org.bytedeco.opencv.opencv_highgui.*; +import static org.bytedeco.opencv.global.opencv_highgui.*; +import org.bytedeco.hdf5.*; +import static org.bytedeco.hdf5.global.hdf5.*; +import org.bytedeco.caffe.*; +import static org.bytedeco.caffe.global.caffe.*; + +import static org.bytedeco.openpose.global.openpose.*; + +@Name("std::array,2>") @Properties(inherit = org.bytedeco.openpose.presets.openpose.class) +public class FloatArray2 extends Pointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public FloatArray2(Pointer p) { super(p); } + public FloatArray2() { allocate(); } + private native void allocate(); + public native @Name("operator =") @ByRef FloatArray2 put(@ByRef FloatArray2 x); + + public boolean empty() { return size() == 0; } + public native long size(); + + @Index public native @ByRef FloatArray get(@Cast("size_t") long i); + public native FloatArray2 put(@Cast("size_t") long i, FloatArray value); +} + diff --git a/openpose/src/gen/java/org/bytedeco/openpose/FloatPoint.java b/openpose/src/gen/java/org/bytedeco/openpose/FloatPoint.java new file mode 100644 index 00000000000..ea4d6d61f67 --- /dev/null +++ b/openpose/src/gen/java/org/bytedeco/openpose/FloatPoint.java @@ -0,0 +1,165 @@ +// Targeted by JavaCPP version 1.5.4-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.openpose; + +import org.bytedeco.javacpp.annotation.Index; +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import static org.bytedeco.openblas.global.openblas_nolapack.*; +import static org.bytedeco.openblas.global.openblas.*; +import org.bytedeco.opencv.opencv_core.*; +import static org.bytedeco.opencv.global.opencv_core.*; +import org.bytedeco.opencv.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgcodecs.*; +import org.bytedeco.opencv.opencv_videoio.*; +import static org.bytedeco.opencv.global.opencv_videoio.*; +import org.bytedeco.opencv.opencv_highgui.*; +import static org.bytedeco.opencv.global.opencv_highgui.*; +import org.bytedeco.hdf5.*; +import static org.bytedeco.hdf5.global.hdf5.*; +import org.bytedeco.caffe.*; +import static org.bytedeco.caffe.global.caffe.*; + +import static org.bytedeco.openpose.global.openpose.*; + + @Name("op::Point") @NoOffset @Properties(inherit = org.bytedeco.openpose.presets.openpose.class) +public class FloatPoint extends Pointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public FloatPoint(Pointer p) { super(p); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public FloatPoint(long size) { super((Pointer)null); allocateArray(size); } + private native void allocateArray(long size); + @Override public FloatPoint position(long position) { + return (FloatPoint)super.position(position); + } + + public native float x(); public native FloatPoint x(float setter); + public native float y(); public native FloatPoint y(float setter); + + public FloatPoint(float x/*=0*/, float y/*=0*/) { super((Pointer)null); allocate(x, y); } + private native void allocate(float x/*=0*/, float y/*=0*/); + public FloatPoint() { super((Pointer)null); allocate(); } + private native void allocate(); + + /** + * Copy constructor. + * It performs {@code fast copy}: For performance purpose, copying a Point or Point or cv::Mat just copies the + * reference, it still shares the same internal data. + * Modifying the copied element will modify the original one. + * Use clone() for a slower but real copy, similarly to cv::Mat and Point. + * @param point Point to be copied. + */ + public FloatPoint(@Const @ByRef FloatPoint point) { super((Pointer)null); allocate(point); } + private native void allocate(@Const @ByRef FloatPoint point); + + /** + * Copy assignment. + * Similar to Point(const Point& point). + * @param point Point to be copied. + * @return The resulting Point. + */ + public native @ByRef @Name("operator =") FloatPoint put(@Const @ByRef FloatPoint point); + + /** + * Move constructor. + * It destroys the original Point to be moved. + * @param point Point to be moved. + */ + + /** + * Move assignment. + * Similar to Point(Point&& point). + * @param point Point to be moved. + * @return The resulting Point. + */ + + public native float area(); + + /** + * It returns a string with the whole Point data. Useful for debugging. + * The format is: {@code [x, y]} + * @return A string with the Point values in the above format. + */ + + + + + + + // ------------------------------ Comparison operators ------------------------------ // + /** + * Less comparison operator. + * @param point Point to be compared. + * @return Whether the instance satisfies the condition with respect to point. + */ + public native @Cast("bool") @Name("operator <") boolean lessThan(@Const @ByRef FloatPoint point); + + /** + * Greater comparison operator. + * @param point Point to be compared. + * @return Whether the instance satisfies the condition with respect to point. + */ + public native @Cast("bool") @Name("operator >") boolean greaterThan(@Const @ByRef FloatPoint point); + + /** + * Less or equal comparison operator. + * @param point Point to be compared. + * @return Whether the instance satisfies the condition with respect to point. + */ + public native @Cast("bool") @Name("operator <=") boolean lessThanEquals(@Const @ByRef FloatPoint point); + + /** + * Greater or equal comparison operator. + * @param point Point to be compared. + * @return Whether the instance satisfies the condition with respect to point. + */ + public native @Cast("bool") @Name("operator >=") boolean greaterThanEquals(@Const @ByRef FloatPoint point); + + /** + * Equal comparison operator. + * @param point Point to be compared. + * @return Whether the instance satisfies the condition with respect to point. + */ + public native @Cast("bool") @Name("operator ==") boolean equals(@Const @ByRef FloatPoint point); + + /** + * Not equal comparison operator. + * @param point Point to be compared. + * @return Whether the instance satisfies the condition with respect to point. + */ + public native @Cast("bool") @Name("operator !=") boolean notEquals(@Const @ByRef FloatPoint point); + + + + + + // ------------------------------ Basic Operators ------------------------------ // + public native @ByRef @Name("operator +=") FloatPoint addPut(@Const @ByRef FloatPoint point); + + public native @ByVal @Name("operator +") FloatPoint add(@Const @ByRef FloatPoint point); + + public native @ByRef @Name("operator +=") FloatPoint addPut(float value); + + public native @ByVal @Name("operator +") FloatPoint add(float value); + + public native @ByRef @Name("operator -=") FloatPoint subtractPut(@Const @ByRef FloatPoint point); + + public native @ByVal @Name("operator -") FloatPoint subtract(@Const @ByRef FloatPoint point); + + public native @ByRef @Name("operator -=") FloatPoint subtractPut(float value); + + public native @ByVal @Name("operator -") FloatPoint subtract(float value); + + public native @ByRef @Name("operator *=") FloatPoint multiplyPut(float value); + + public native @ByVal @Name("operator *") FloatPoint multiply(float value); + + public native @ByRef @Name("operator /=") FloatPoint dividePut(float value); + + public native @ByVal @Name("operator /") FloatPoint divide(float value); + } diff --git a/openpose/src/gen/java/org/bytedeco/openpose/FloatRectangle.java b/openpose/src/gen/java/org/bytedeco/openpose/FloatRectangle.java new file mode 100644 index 00000000000..0b6deef4ef7 --- /dev/null +++ b/openpose/src/gen/java/org/bytedeco/openpose/FloatRectangle.java @@ -0,0 +1,108 @@ +// Targeted by JavaCPP version 1.5.4-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.openpose; + +import org.bytedeco.javacpp.annotation.Index; +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import static org.bytedeco.openblas.global.openblas_nolapack.*; +import static org.bytedeco.openblas.global.openblas.*; +import org.bytedeco.opencv.opencv_core.*; +import static org.bytedeco.opencv.global.opencv_core.*; +import org.bytedeco.opencv.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgcodecs.*; +import org.bytedeco.opencv.opencv_videoio.*; +import static org.bytedeco.opencv.global.opencv_videoio.*; +import org.bytedeco.opencv.opencv_highgui.*; +import static org.bytedeco.opencv.global.opencv_highgui.*; +import org.bytedeco.hdf5.*; +import static org.bytedeco.hdf5.global.hdf5.*; +import org.bytedeco.caffe.*; +import static org.bytedeco.caffe.global.caffe.*; + +import static org.bytedeco.openpose.global.openpose.*; + + @Name("op::Rectangle") @NoOffset @Properties(inherit = org.bytedeco.openpose.presets.openpose.class) +public class FloatRectangle extends Pointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public FloatRectangle(Pointer p) { super(p); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public FloatRectangle(long size) { super((Pointer)null); allocateArray(size); } + private native void allocateArray(long size); + @Override public FloatRectangle position(long position) { + return (FloatRectangle)super.position(position); + } + + public native float x(); public native FloatRectangle x(float setter); + public native float y(); public native FloatRectangle y(float setter); + public native float width(); public native FloatRectangle width(float setter); + public native float height(); public native FloatRectangle height(float setter); + + public FloatRectangle(float x/*=0*/, float y/*=0*/, float width/*=0*/, float height/*=0*/) { super((Pointer)null); allocate(x, y, width, height); } + private native void allocate(float x/*=0*/, float y/*=0*/, float width/*=0*/, float height/*=0*/); + public FloatRectangle() { super((Pointer)null); allocate(); } + private native void allocate(); + + /** + * Copy constructor. + * It performs {@code fast copy}: For performance purpose, copying a Rectangle or Datum or cv::Mat just copies + * the reference, it still shares the same internal data. + * Modifying the copied element will modify the original one. + * Use clone() for a slower but real copy, similarly to cv::Mat and Rectangle. + * @param rectangle Rectangle to be copied. + */ + public FloatRectangle(@Const @ByRef FloatRectangle rectangle) { super((Pointer)null); allocate(rectangle); } + private native void allocate(@Const @ByRef FloatRectangle rectangle); + + /** + * Copy assignment. + * Similar to Rectangle(const Rectangle& rectangle). + * @param rectangle Rectangle to be copied. + * @return The resulting Rectangle. + */ + public native @ByRef @Name("operator =") FloatRectangle put(@Const @ByRef FloatRectangle rectangle); + + /** + * Move constructor. + * It destroys the original Rectangle to be moved. + * @param rectangle Rectangle to be moved. + */ + + /** + * Move assignment. + * Similar to Rectangle(Rectangle&& rectangle). + * @param rectangle Rectangle to be moved. + * @return The resulting Rectangle. + */ + + public native @ByVal FloatPoint center(); + + public native @ByVal FloatPoint topLeft(); + + public native @ByVal FloatPoint bottomRight(); + + public native float area(); + + public native void recenter(float newWidth, float newHeight); + + /** + * It returns a string with the whole Rectangle data. Useful for debugging. + * The format is: {@code [x, y, width, height]} + * @return A string with the Rectangle values in the above format. + */ + + + // ------------------------------ Basic Operators ------------------------------ // + public native @ByRef @Name("operator *=") FloatRectangle multiplyPut(float value); + + public native @ByVal @Name("operator *") FloatRectangle multiply(float value); + + public native @ByRef @Name("operator /=") FloatRectangle dividePut(float value); + + public native @ByVal @Name("operator /") FloatRectangle divide(float value); + } diff --git a/openpose/src/gen/java/org/bytedeco/openpose/FloatRectangle2.java b/openpose/src/gen/java/org/bytedeco/openpose/FloatRectangle2.java new file mode 100644 index 00000000000..d8d13f16631 --- /dev/null +++ b/openpose/src/gen/java/org/bytedeco/openpose/FloatRectangle2.java @@ -0,0 +1,44 @@ +// Targeted by JavaCPP version 1.5.4-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.openpose; + +import org.bytedeco.javacpp.annotation.Index; +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import static org.bytedeco.openblas.global.openblas_nolapack.*; +import static org.bytedeco.openblas.global.openblas.*; +import org.bytedeco.opencv.opencv_core.*; +import static org.bytedeco.opencv.global.opencv_core.*; +import org.bytedeco.opencv.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgcodecs.*; +import org.bytedeco.opencv.opencv_videoio.*; +import static org.bytedeco.opencv.global.opencv_videoio.*; +import org.bytedeco.opencv.opencv_highgui.*; +import static org.bytedeco.opencv.global.opencv_highgui.*; +import org.bytedeco.hdf5.*; +import static org.bytedeco.hdf5.global.hdf5.*; +import org.bytedeco.caffe.*; +import static org.bytedeco.caffe.global.caffe.*; + +import static org.bytedeco.openpose.global.openpose.*; + +@Name("std::array,2>") @Properties(inherit = org.bytedeco.openpose.presets.openpose.class) +public class FloatRectangle2 extends Pointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public FloatRectangle2(Pointer p) { super(p); } + public FloatRectangle2() { allocate(); } + private native void allocate(); + public native @Name("operator =") @ByRef FloatRectangle2 put(@ByRef FloatRectangle2 x); + + public boolean empty() { return size() == 0; } + public native long size(); + + @Index public native @ByRef FloatRectangle get(@Cast("size_t") long i); + public native FloatRectangle2 put(@Cast("size_t") long i, FloatRectangle value); +} + diff --git a/openpose/src/gen/java/org/bytedeco/openpose/HeatMapTypeVector.java b/openpose/src/gen/java/org/bytedeco/openpose/HeatMapTypeVector.java new file mode 100644 index 00000000000..c3f41c94111 --- /dev/null +++ b/openpose/src/gen/java/org/bytedeco/openpose/HeatMapTypeVector.java @@ -0,0 +1,97 @@ +// Targeted by JavaCPP version 1.5.4-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.openpose; + +import org.bytedeco.javacpp.annotation.Index; +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import static org.bytedeco.openblas.global.openblas_nolapack.*; +import static org.bytedeco.openblas.global.openblas.*; +import org.bytedeco.opencv.opencv_core.*; +import static org.bytedeco.opencv.global.opencv_core.*; +import org.bytedeco.opencv.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgcodecs.*; +import org.bytedeco.opencv.opencv_videoio.*; +import static org.bytedeco.opencv.global.opencv_videoio.*; +import org.bytedeco.opencv.opencv_highgui.*; +import static org.bytedeco.opencv.global.opencv_highgui.*; +import org.bytedeco.hdf5.*; +import static org.bytedeco.hdf5.global.hdf5.*; +import org.bytedeco.caffe.*; +import static org.bytedeco.caffe.global.caffe.*; + +import static org.bytedeco.openpose.global.openpose.*; + +@Name("std::vector") @Properties(inherit = org.bytedeco.openpose.presets.openpose.class) +public class HeatMapTypeVector extends Pointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public HeatMapTypeVector(Pointer p) { super(p); } + public HeatMapTypeVector(HeatMapType value) { this(1); put(0, value); } + public HeatMapTypeVector(HeatMapType ... array) { this(array.length); put(array); } + public HeatMapTypeVector() { allocate(); } + public HeatMapTypeVector(long n) { allocate(n); } + private native void allocate(); + private native void allocate(@Cast("size_t") long n); + public native @Name("operator =") @ByRef HeatMapTypeVector put(@ByRef HeatMapTypeVector x); + + public boolean empty() { return size() == 0; } + public native long size(); + public void clear() { resize(0); } + public native void resize(@Cast("size_t") long n); + + @Index(function = "at") public native @ByRef HeatMapType get(@Cast("size_t") long i); + public native HeatMapTypeVector put(@Cast("size_t") long i, HeatMapType value); + + public native @ByVal Iterator insert(@ByVal Iterator pos, @ByRef HeatMapType value); + public native @ByVal Iterator erase(@ByVal Iterator pos); + public native @ByVal Iterator begin(); + public native @ByVal Iterator end(); + @NoOffset @Name("iterator") public static class Iterator extends Pointer { + public Iterator(Pointer p) { super(p); } + public Iterator() { } + + public native @Name("operator ++") @ByRef Iterator increment(); + public native @Name("operator ==") boolean equals(@ByRef Iterator it); + public native @Name("operator *") @ByRef @Const HeatMapType get(); + } + + public HeatMapType[] get() { + HeatMapType[] array = new HeatMapType[size() < Integer.MAX_VALUE ? (int)size() : Integer.MAX_VALUE]; + for (int i = 0; i < array.length; i++) { + array[i] = get(i); + } + return array; + } + @Override public String toString() { + return java.util.Arrays.toString(get()); + } + + public HeatMapType pop_back() { + long size = size(); + HeatMapType value = get(size - 1); + resize(size - 1); + return value; + } + public HeatMapTypeVector push_back(HeatMapType value) { + long size = size(); + resize(size + 1); + return put(size, value); + } + public HeatMapTypeVector put(HeatMapType value) { + if (size() != 1) { resize(1); } + return put(0, value); + } + public HeatMapTypeVector put(HeatMapType ... array) { + if (size() != array.length) { resize(array.length); } + for (int i = 0; i < array.length; i++) { + put(i, array[i]); + } + return this; + } +} + diff --git a/openpose/src/gen/java/org/bytedeco/openpose/IntPoint.java b/openpose/src/gen/java/org/bytedeco/openpose/IntPoint.java new file mode 100644 index 00000000000..76d240f3e8c --- /dev/null +++ b/openpose/src/gen/java/org/bytedeco/openpose/IntPoint.java @@ -0,0 +1,165 @@ +// Targeted by JavaCPP version 1.5.4-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.openpose; + +import org.bytedeco.javacpp.annotation.Index; +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import static org.bytedeco.openblas.global.openblas_nolapack.*; +import static org.bytedeco.openblas.global.openblas.*; +import org.bytedeco.opencv.opencv_core.*; +import static org.bytedeco.opencv.global.opencv_core.*; +import org.bytedeco.opencv.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgcodecs.*; +import org.bytedeco.opencv.opencv_videoio.*; +import static org.bytedeco.opencv.global.opencv_videoio.*; +import org.bytedeco.opencv.opencv_highgui.*; +import static org.bytedeco.opencv.global.opencv_highgui.*; +import org.bytedeco.hdf5.*; +import static org.bytedeco.hdf5.global.hdf5.*; +import org.bytedeco.caffe.*; +import static org.bytedeco.caffe.global.caffe.*; + +import static org.bytedeco.openpose.global.openpose.*; + + @Name("op::Point") @NoOffset @Properties(inherit = org.bytedeco.openpose.presets.openpose.class) +public class IntPoint extends Pointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public IntPoint(Pointer p) { super(p); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public IntPoint(long size) { super((Pointer)null); allocateArray(size); } + private native void allocateArray(long size); + @Override public IntPoint position(long position) { + return (IntPoint)super.position(position); + } + + public native int x(); public native IntPoint x(int setter); + public native int y(); public native IntPoint y(int setter); + + public IntPoint(int x/*=0*/, int y/*=0*/) { super((Pointer)null); allocate(x, y); } + private native void allocate(int x/*=0*/, int y/*=0*/); + public IntPoint() { super((Pointer)null); allocate(); } + private native void allocate(); + + /** + * Copy constructor. + * It performs {@code fast copy}: For performance purpose, copying a Point or Point or cv::Mat just copies the + * reference, it still shares the same internal data. + * Modifying the copied element will modify the original one. + * Use clone() for a slower but real copy, similarly to cv::Mat and Point. + * @param point Point to be copied. + */ + public IntPoint(@Const @ByRef IntPoint point) { super((Pointer)null); allocate(point); } + private native void allocate(@Const @ByRef IntPoint point); + + /** + * Copy assignment. + * Similar to Point(const Point& point). + * @param point Point to be copied. + * @return The resulting Point. + */ + public native @ByRef @Name("operator =") IntPoint put(@Const @ByRef IntPoint point); + + /** + * Move constructor. + * It destroys the original Point to be moved. + * @param point Point to be moved. + */ + + /** + * Move assignment. + * Similar to Point(Point&& point). + * @param point Point to be moved. + * @return The resulting Point. + */ + + public native int area(); + + /** + * It returns a string with the whole Point data. Useful for debugging. + * The format is: {@code [x, y]} + * @return A string with the Point values in the above format. + */ + + + + + + + // ------------------------------ Comparison operators ------------------------------ // + /** + * Less comparison operator. + * @param point Point to be compared. + * @return Whether the instance satisfies the condition with respect to point. + */ + public native @Cast("bool") @Name("operator <") boolean lessThan(@Const @ByRef IntPoint point); + + /** + * Greater comparison operator. + * @param point Point to be compared. + * @return Whether the instance satisfies the condition with respect to point. + */ + public native @Cast("bool") @Name("operator >") boolean greaterThan(@Const @ByRef IntPoint point); + + /** + * Less or equal comparison operator. + * @param point Point to be compared. + * @return Whether the instance satisfies the condition with respect to point. + */ + public native @Cast("bool") @Name("operator <=") boolean lessThanEquals(@Const @ByRef IntPoint point); + + /** + * Greater or equal comparison operator. + * @param point Point to be compared. + * @return Whether the instance satisfies the condition with respect to point. + */ + public native @Cast("bool") @Name("operator >=") boolean greaterThanEquals(@Const @ByRef IntPoint point); + + /** + * Equal comparison operator. + * @param point Point to be compared. + * @return Whether the instance satisfies the condition with respect to point. + */ + public native @Cast("bool") @Name("operator ==") boolean equals(@Const @ByRef IntPoint point); + + /** + * Not equal comparison operator. + * @param point Point to be compared. + * @return Whether the instance satisfies the condition with respect to point. + */ + public native @Cast("bool") @Name("operator !=") boolean notEquals(@Const @ByRef IntPoint point); + + + + + + // ------------------------------ Basic Operators ------------------------------ // + public native @ByRef @Name("operator +=") IntPoint addPut(@Const @ByRef IntPoint point); + + public native @ByVal @Name("operator +") IntPoint add(@Const @ByRef IntPoint point); + + public native @ByRef @Name("operator +=") IntPoint addPut(int value); + + public native @ByVal @Name("operator +") IntPoint add(int value); + + public native @ByRef @Name("operator -=") IntPoint subtractPut(@Const @ByRef IntPoint point); + + public native @ByVal @Name("operator -") IntPoint subtract(@Const @ByRef IntPoint point); + + public native @ByRef @Name("operator -=") IntPoint subtractPut(int value); + + public native @ByVal @Name("operator -") IntPoint subtract(int value); + + public native @ByRef @Name("operator *=") IntPoint multiplyPut(int value); + + public native @ByVal @Name("operator *") IntPoint multiply(int value); + + public native @ByRef @Name("operator /=") IntPoint dividePut(int value); + + public native @ByVal @Name("operator /") IntPoint divide(int value); + } diff --git a/openpose/src/gen/java/org/bytedeco/openpose/IntStringPair.java b/openpose/src/gen/java/org/bytedeco/openpose/IntStringPair.java new file mode 100644 index 00000000000..8bfb5ee223e --- /dev/null +++ b/openpose/src/gen/java/org/bytedeco/openpose/IntStringPair.java @@ -0,0 +1,57 @@ +// Targeted by JavaCPP version 1.5.4-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.openpose; + +import org.bytedeco.javacpp.annotation.Index; +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import static org.bytedeco.openblas.global.openblas_nolapack.*; +import static org.bytedeco.openblas.global.openblas.*; +import org.bytedeco.opencv.opencv_core.*; +import static org.bytedeco.opencv.global.opencv_core.*; +import org.bytedeco.opencv.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgcodecs.*; +import org.bytedeco.opencv.opencv_videoio.*; +import static org.bytedeco.opencv.global.opencv_videoio.*; +import org.bytedeco.opencv.opencv_highgui.*; +import static org.bytedeco.opencv.global.opencv_highgui.*; +import org.bytedeco.hdf5.*; +import static org.bytedeco.hdf5.global.hdf5.*; +import org.bytedeco.caffe.*; +import static org.bytedeco.caffe.global.caffe.*; + +import static org.bytedeco.openpose.global.openpose.*; + +@NoOffset @Name("std::pair") @Properties(inherit = org.bytedeco.openpose.presets.openpose.class) +public class IntStringPair extends Pointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public IntStringPair(Pointer p) { super(p); } + public IntStringPair(int firstValue, BytePointer secondValue) { this(); put(firstValue, secondValue); } + public IntStringPair(int firstValue, String secondValue) { this(); put(firstValue, secondValue); } + public IntStringPair() { allocate(); } + private native void allocate(); + public native @Name("operator =") @ByRef IntStringPair put(@ByRef IntStringPair x); + + + @MemberGetter public native int first(); public native IntStringPair first(int first); + @MemberGetter public native @StdString BytePointer second(); public native IntStringPair second(BytePointer second); + @MemberSetter @Index public native IntStringPair second(@StdString String second); + + public IntStringPair put(int firstValue, BytePointer secondValue) { + first(firstValue); + second(secondValue); + return this; + } + + public IntStringPair put(int firstValue, String secondValue) { + first(firstValue); + second(secondValue); + return this; + } +} + diff --git a/openpose/src/gen/java/org/bytedeco/openpose/LongLongArray.java b/openpose/src/gen/java/org/bytedeco/openpose/LongLongArray.java new file mode 100644 index 00000000000..cb232c425b1 --- /dev/null +++ b/openpose/src/gen/java/org/bytedeco/openpose/LongLongArray.java @@ -0,0 +1,455 @@ +// Targeted by JavaCPP version 1.5.4-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.openpose; + +import org.bytedeco.javacpp.annotation.Index; +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import static org.bytedeco.openblas.global.openblas_nolapack.*; +import static org.bytedeco.openblas.global.openblas.*; +import org.bytedeco.opencv.opencv_core.*; +import static org.bytedeco.opencv.global.opencv_core.*; +import org.bytedeco.opencv.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgcodecs.*; +import org.bytedeco.opencv.opencv_videoio.*; +import static org.bytedeco.opencv.global.opencv_videoio.*; +import org.bytedeco.opencv.opencv_highgui.*; +import static org.bytedeco.opencv.global.opencv_highgui.*; +import org.bytedeco.hdf5.*; +import static org.bytedeco.hdf5.global.hdf5.*; +import org.bytedeco.caffe.*; +import static org.bytedeco.caffe.global.caffe.*; + +import static org.bytedeco.openpose.global.openpose.*; + + @Name("op::Array") @NoOffset @Properties(inherit = org.bytedeco.openpose.presets.openpose.class) +public class LongLongArray extends Pointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public LongLongArray(Pointer p) { super(p); } + + // ------------------------------ Constructors and Data Allocator Functions ------------------------------ // + /** + * Array constructor. + * Equivalent to default constructor + reset(const int size). + * @param size Integer with the number of T element to be allocated. E.g., size = 5 is internally similar to + * {@code new T[5]}. + */ + public LongLongArray(int size) { super((Pointer)null); allocate(size); } + private native void allocate(int size); + + /** + * Array constructor. + * Equivalent to default constructor + reset(const std::vector& size = {}). + * @param sizes Vector with the size of each dimension. E.g., size = {3, 5, 2} is internally similar to + * {@code new T[3*5*2]}. + */ + public LongLongArray(@StdVector IntPointer sizes/*={}*/) { super((Pointer)null); allocate(sizes); } + private native void allocate(@StdVector IntPointer sizes/*={}*/); + public LongLongArray() { super((Pointer)null); allocate(); } + private native void allocate(); + public LongLongArray(@StdVector IntBuffer sizes/*={}*/) { super((Pointer)null); allocate(sizes); } + private native void allocate(@StdVector IntBuffer sizes/*={}*/); + public LongLongArray(@StdVector int[] sizes/*={}*/) { super((Pointer)null); allocate(sizes); } + private native void allocate(@StdVector int[] sizes/*={}*/); + + /** + * Array constructor. + * Equivalent to default constructor + reset(const int size, const T value). + * @param size Integer with the number of T element to be allocated. E.g., size = 5 is internally similar to + * {@code new T[5]}. + * @param value Initial value for each component of the Array. + */ + public LongLongArray(int size, long value) { super((Pointer)null); allocate(size, value); } + private native void allocate(int size, long value); + + /** + * Array constructor. + * Equivalent to default constructor + reset(const std::vector& size, const T value). + * @param sizes Vector with the size of each dimension. E.g., size = {3, 5, 2} is internally similar to: + * {@code new T[3*5*2]}. + * @param value Initial value for each component of the Array. + */ + public LongLongArray(@StdVector IntPointer sizes, long value) { super((Pointer)null); allocate(sizes, value); } + private native void allocate(@StdVector IntPointer sizes, long value); + public LongLongArray(@StdVector IntBuffer sizes, long value) { super((Pointer)null); allocate(sizes, value); } + private native void allocate(@StdVector IntBuffer sizes, long value); + public LongLongArray(@StdVector int[] sizes, long value) { super((Pointer)null); allocate(sizes, value); } + private native void allocate(@StdVector int[] sizes, long value); + + /** + * Array constructor. + * Equivalent to default constructor, but it does not allocate memory, but rather use dataPtr. + * @param size Integer with the number of T element to be allocated. E.g., size = 5 is internally similar to + * {@code new T[5]}. + * @param dataPtr Pointer to the memory to be used by the Array. + */ + public LongLongArray(int size, LongPointer dataPtr) { super((Pointer)null); allocate(size, dataPtr); } + private native void allocate(int size, LongPointer dataPtr); + public LongLongArray(int size, LongBuffer dataPtr) { super((Pointer)null); allocate(size, dataPtr); } + private native void allocate(int size, LongBuffer dataPtr); + public LongLongArray(int size, long[] dataPtr) { super((Pointer)null); allocate(size, dataPtr); } + private native void allocate(int size, long[] dataPtr); + + /** + * Array constructor. + * Equivalent to default constructor, but it does not allocate memory, but rather use dataPtr. + * @param sizes Vector with the size of each dimension. E.g., size = {3, 5, 2} is internally similar to: + * {@code new T[3*5*2]}. + * @param dataPtr Pointer to the memory to be used by the Array. + */ + public LongLongArray(@StdVector IntPointer sizes, LongPointer dataPtr) { super((Pointer)null); allocate(sizes, dataPtr); } + private native void allocate(@StdVector IntPointer sizes, LongPointer dataPtr); + public LongLongArray(@StdVector IntBuffer sizes, LongBuffer dataPtr) { super((Pointer)null); allocate(sizes, dataPtr); } + private native void allocate(@StdVector IntBuffer sizes, LongBuffer dataPtr); + public LongLongArray(@StdVector int[] sizes, long[] dataPtr) { super((Pointer)null); allocate(sizes, dataPtr); } + private native void allocate(@StdVector int[] sizes, long[] dataPtr); + + /** + * Array constructor. + * @param array Array with the original data array to slice. + * @param index indicates the index of the array to extract. + * @param noCopy indicates whether to perform a copy. Copy will never go to undefined behavior, however, if + * noCopy == true, then: + * 1. It is faster, as no data copy is involved, but... + * 2. If the Array array goes out of scope, then the resulting Array will provoke an undefined behavior. + * 3. If the returned Array is modified, the information in the Array array will also be. + * @return Array with the same dimension than array expect the first dimension being 1. E.g., if array + * is {p,k,m}, the resulting Array is {1,k,m}. + */ + public LongLongArray(@Const @ByRef LongLongArray array, int index, @Cast("const bool") boolean noCopy/*=false*/) { super((Pointer)null); allocate(array, index, noCopy); } + private native void allocate(@Const @ByRef LongLongArray array, int index, @Cast("const bool") boolean noCopy/*=false*/); + public LongLongArray(@Const @ByRef LongLongArray array, int index) { super((Pointer)null); allocate(array, index); } + private native void allocate(@Const @ByRef LongLongArray array, int index); + + /** + * Array constructor. It manually copies the Array into the new Array + * @param array Array with a format T2 different to the current Array type T. + */ + + /** + * Copy constructor. + * It performs {@code fast copy}: For performance purpose, copying a Array or Datum or cv::Mat just copies the + * reference, it still shares the same internal data. + * Modifying the copied element will modify the original one. + * Use clone() for a slower but real copy, similarly to cv::Mat and Array. + * @param array Array to be copied. + */ + public LongLongArray(@Const @ByRef LongLongArray array) { super((Pointer)null); allocate(array); } + private native void allocate(@Const @ByRef LongLongArray array); + + /** + * Copy assignment. + * Similar to Array(const Array& array). + * @param array Array to be copied. + * @return The resulting Array. + */ + public native @ByRef @Name("operator =") LongLongArray put(@Const @ByRef LongLongArray array); + + /** + * Move constructor. + * It destroys the original Array to be moved. + * @param array Array to be moved. + */ + + /** + * Move assignment. + * Similar to Array(Array&& array). + * @param array Array to be moved. + * @return The resulting Array. + */ + + /** + * Clone function. + * Similar to cv::Mat::clone and Datum::clone. + * It performs a real but slow copy of the data, i.e., even if the copied element is modified, the original + * one is not. + * @return The resulting Array. + */ + public native @ByVal LongLongArray clone(); + + /** + * Data allocation function. + * It allocates the required space for the memory (it does not initialize that memory). + * @param size Integer with the number of T element to be allocated. E.g., size = 5 is internally similar to + * {@code new T[5]}. + */ + public native void reset(int size); + + /** + * Data allocation function. + * Similar to reset(const int size), but it allocates a multi-dimensional array of dimensions each of the + * values of the argument. + * @param sizes Vector with the size of each dimension. E.g., size = {3, 5, 2} is internally similar to + * {@code new T[3*5*2]}. + */ + public native void reset(@StdVector IntPointer sizes/*={}*/); + public native void reset(); + public native void reset(@StdVector IntBuffer sizes/*={}*/); + public native void reset(@StdVector int[] sizes/*={}*/); + + /** + * Data allocation function. + * Similar to reset(const int size), but initializing the data to the value specified by the second argument. + * @param size Integer with the number of T element to be allocated. E.g., size = 5 is internally similar to + * {@code new T[5]}. + * @param value Initial value for each component of the Array. + */ + public native void reset(int size, long value); + + /** + * Data allocation function. + * Similar to reset(const std::vector& size), but initializing the data to the value specified by the + * second argument. + * @param sizes Vector with the size of each dimension. E.g., size = {3, 5, 2} is internally similar to + * {@code new T[3*5*2]}. + * @param value Initial value for each component of the Array. + */ + public native void reset(@StdVector IntPointer sizes, long value); + public native void reset(@StdVector IntBuffer sizes, long value); + public native void reset(@StdVector int[] sizes, long value); + + /** + * Data allocation function. + * Equivalent to default constructor, but it does not allocate memory, but rather use dataPtr. + * @param size Integer with the number of T element to be allocated. E.g., size = 5 is internally similar to + * {@code new T[5]}. + * @param dataPtr Pointer to the memory to be used by the Array. + */ + public native void reset(int size, LongPointer dataPtr); + public native void reset(int size, LongBuffer dataPtr); + public native void reset(int size, long[] dataPtr); + + /** + * Data allocation function. + * Equivalent to default constructor, but it does not allocate memory, but rather use dataPtr. + * @param sizes Vector with the size of each dimension. E.g., size = {3, 5, 2} is internally similar to: + * {@code new T[3*5*2]}. + * @param dataPtr Pointer to the memory to be used by the Array. + */ + public native void reset(@StdVector IntPointer sizes, LongPointer dataPtr); + public native void reset(@StdVector IntBuffer sizes, LongBuffer dataPtr); + public native void reset(@StdVector int[] sizes, long[] dataPtr); + + /** + * Data allocation function. + * It internally allocates memory and copies the data of the argument to the Array allocated memory. + * @param cvMat Matrix to be copied. + */ + public native void setFrom(@Const @ByRef Matrix cvMat); + + /** + * Data allocation function. + * It internally assigns all the allocated memory to the value indicated by the argument. + * @param value Value for each component of the Array. + */ + public native void setTo(long value); + + + + // ------------------------------ Data Information Functions ------------------------------ // + /** + * Check whether memory has been allocated. + * @return True if no memory has been allocated, false otherwise. + */ + public native @Cast("bool") boolean empty(); + + /** + * Return a vector with the size of each dimension allocated. + * @return A std::vector with the size of each dimension. If no memory has been allocated, it will return + * an empty std::vector. + */ + public native @StdVector IntPointer getSize(); + + /** + * Return a vector with the size of the desired dimension. + * @param index Dimension to check its size. + * @return Size of the desired dimension. It will return 0 if the requested dimension is higher than the number + * of dimensions. + */ + public native int getSize(int index); + + /** + * Return a string with the size of each dimension allocated. + * @return A std::stringwith the size of each dimension. If no memory has been allocated, it will return an + * empty string. + */ + public native @StdString BytePointer printSize(); + + /** + * Return the total number of dimensions, equivalent to getSize().size(). + * @return The number of dimensions. If no memory is allocated, it returns 0. + */ + public native @Cast("size_t") long getNumberDimensions(); + + /** + * Return the total number of elements allocated, equivalent to multiply all the components from getSize(). + * E.g., for a Array of size = {2,5,3}, the volume or total number of elements is: 2x5x3 = 30. + * @return The total volume of the allocated data. If no memory is allocated, it returns 0. + */ + public native @Cast("size_t") long getVolume(); + + /** + * Similar to getVolume(), but in this case it just returns the volume between the desired dimensions. + * E.g., for a Array of size = {2,5,3}, the volume or total number of elements for getVolume(1,2) is + * 5x3 = 15. + * @param indexA Dimension where to start. + * @param indexB Dimension where to stop. If indexB == -1, then it will take up to the last dimension. + * @return The total volume of the allocated data between the desired dimensions. If the index are out of + * bounds, it throws an error. + */ + public native @Cast("size_t") long getVolume(int indexA, int indexB/*=-1*/); + public native @Cast("size_t") long getVolume(int indexA); + + /** + * Return the stride or step size of the array. + * E.g., given and Array of size 5x3, getStride() would return the following vector: + * {5x3sizeof(T), 3sizeof(T), sizeof(T)}. + */ + public native @StdVector IntPointer getStride(); + + /** + * Return the stride or step size of the array at the index-th dimension. + * E.g., given and Array of size 5x3, getStride(2) would return sizeof(T). + */ + public native int getStride(int index); + + + + // ------------------------------ Data Access Functions And Operators ------------------------------ // + /** + * Return a raw pointer to the data. Similar to: std::shared_ptr::get(). + * Note: if you modify the pointer data, you will directly modify it in the Array instance too. + * If you know you do not want to modify the data, then use getConstPtr() instead. + * @return A raw pointer to the data. + */ + public native LongPointer getPtr(); + + /** + * Similar to getPtr(), but it forbids the data to be edited. + * @return A raw const pointer to the data. + */ + public native @Const LongPointer getConstPtr(); + + /** + * Similar to getConstPtr(), but it allows the data to be edited. + * This function is only implemented for Pybind11 usage. + * @return A raw pointer to the data. + */ + public native LongPointer getPseudoConstPtr(); + + /** + * Return a Matrix wrapper to the data. It forbids the data to be modified. + * OpenCV only admits unsigned char, signed char, int, float & double. If the T class is not supported by + * OpenCV, it will throw an error. + * Note: Array does not return an editable Matrix because some OpenCV functions reallocate memory and it + * would not longer point to the Array instance. + * If you want to perform some OpenCV operation on the Array data, you can use: + * editedCvMat = array.getConstCvMat().clone(); + * // modify data + * array.setFrom(editedCvMat) + * @return A const Matrix pointing to the data. + */ + public native @Const @ByRef Matrix getConstCvMat(); + + /** + * Analogous to getConstCvMat, but in this case it returns a editable Matrix. + * Very important: Only allowed functions which do not provoke data reallocation. + * E.g., resizing functions will not work and they would provoke an undefined behavior and/or execution + * crashes. + * @return A Matrix pointing to the data. + */ + public native @ByRef Matrix getCvMat(); + + /** + * [] operator + * Similar to the [] operator for raw pointer data. + * If debug mode is enabled, then it will check that the desired index is in the data range, and it will throw + * an exception otherwise (similar to the at operator). + * @param index The desired memory location. + * @return A editable reference to the data on the desired index location. + */ + public native @ByRef @Name("operator []") LongPointer get(int index); + + /** + * [] operator + * Same functionality as operator[](const int index), but it forbids modifying the value. Otherwise, const + * functions would not be able to call the [] operator. + * @param index The desired memory location. + * @return A non-editable reference to the data on the desired index location. + */ + + /** + * [] operator + * Same functionality as operator[](const int index), but it lets the user introduce the multi-dimensional + * index. + * E.g., given a (10 x 10 x 10) array, array[11] is equivalent to array[{1,1,0}] + * @param indexes Vector with the desired memory location. + * @return A editable reference to the data on the desired index location. + */ + public native @ByRef @Name("operator []") LongPointer get(@StdVector IntPointer indexes); + public native @ByRef @Name("operator []") LongBuffer get(@StdVector IntBuffer indexes); + public native @ByRef @Name("operator []") long[] get(@StdVector int[] indexes); + + /** + * [] operator + * Same functionality as operator[](const std::vector& indexes), but it forbids modifying the value. + * Otherwise, const functions would not be able to call the [] operator. + * @param indexes Vector with the desired memory location. + * @return A non-editable reference to the data on the desired index location. + */ + + /** + * at() function + * Same functionality as operator[](const int index), but it always check whether the indexes are within the + * data bounds. Otherwise, it will throw an error. + * @param index The desired memory location. + * @return A editable reference to the data on the desired index location. + */ + public native @ByRef LongPointer at(int index); + + /** + * at() function + * Same functionality as operator[](const int index) const, but it always check whether the indexes are within + * the data bounds. Otherwise, it will throw an error. + * @param index The desired memory location. + * @return A non-editable reference to the data on the desired index location. + */ + + /** + * at() function + * Same functionality as operator[](const std::vector& indexes), but it always check whether the indexes + * are within the data bounds. Otherwise, it will throw an error. + * @param indexes Vector with the desired memory location. + * @return A editable reference to the data on the desired index location. + */ + public native @ByRef LongPointer at(@StdVector IntPointer indexes); + public native @ByRef LongBuffer at(@StdVector IntBuffer indexes); + public native @ByRef long[] at(@StdVector int[] indexes); + + /** + * at() function + * Same functionality as operator[](const std::vector& indexes) const, but it always check whether the + * indexes are within the data bounds. Otherwise, it will throw an error. + * @param indexes Vector with the desired memory location. + * @return A non-editable reference to the data on the desired index location. + */ + + /** + * It returns a string with the whole array data. Useful for debugging. + * The format is: values separated by a space, and a enter for each dimension. E.g., + * For the Array{2, 2, 3}, it will print: + * Array::toString(): + * x1 x2 x3 + * x4 x5 x6 + * + * x7 x8 x9 + * x10 x11 x12 + * @return A string with the array values in the above format. + */ + + } diff --git a/openpose/src/gen/java/org/bytedeco/openpose/Matrix.java b/openpose/src/gen/java/org/bytedeco/openpose/Matrix.java new file mode 100644 index 00000000000..8a31382f94d --- /dev/null +++ b/openpose/src/gen/java/org/bytedeco/openpose/Matrix.java @@ -0,0 +1,144 @@ +// Targeted by JavaCPP version 1.5.4-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.openpose; + +import org.bytedeco.javacpp.annotation.Index; +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import static org.bytedeco.openblas.global.openblas_nolapack.*; +import static org.bytedeco.openblas.global.openblas.*; +import org.bytedeco.opencv.opencv_core.*; +import static org.bytedeco.opencv.global.opencv_core.*; +import org.bytedeco.opencv.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgcodecs.*; +import org.bytedeco.opencv.opencv_videoio.*; +import static org.bytedeco.opencv.global.opencv_videoio.*; +import org.bytedeco.opencv.opencv_highgui.*; +import static org.bytedeco.opencv.global.opencv_highgui.*; +import org.bytedeco.hdf5.*; +import static org.bytedeco.hdf5.global.hdf5.*; +import org.bytedeco.caffe.*; +import static org.bytedeco.caffe.global.caffe.*; + +import static org.bytedeco.openpose.global.openpose.*; + + + /** + * Matrix: Bind of cv::Mat to avoid OpenCV as dependency in the headers. + */ + @Namespace("op") @NoOffset @Properties(inherit = org.bytedeco.openpose.presets.openpose.class) +public class Matrix extends Pointer { + static { Loader.load(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public Matrix(long size) { super((Pointer)null); allocateArray(size); } + private native void allocateArray(long size); + @Override public Matrix position(long position) { + return (Matrix)super.position(position); + } + + /** + * @param matrixesResized For 3-D OpenPose, if >1, it will assume the image is composed of + * numberImagesStackedHorizontally horizontally stacked images. It must be already resized to avoid + * internally allocating/removing elements of std::vector (to avoid errors if using different std DLLs) + * @param cvMatPtr should be a cv::Mat element or it will provoke a core dumped. Done to + * avoid explicitly exposing 3rdparty libraries on the headers. + */ + public static native void splitCvMatIntoVectorMatrix(@StdVector Matrix matrixesResized, @Const Pointer cvMatPtr); + + public Matrix() { super((Pointer)null); allocate(); } + private native void allocate(); + + /** + * @param cvMatPtr should be a cv::Mat element or it will provoke a core dumped. Done to + * avoid explicitly exposing 3rdparty libraries on the headers. + */ + public Matrix(@Const Pointer cvMatPtr) { super((Pointer)null); allocate(cvMatPtr); } + private native void allocate(@Const Pointer cvMatPtr); + + /** + * Analog to cv::Mat(int rows, int cols, int type, void *data, size_t step=AUTO_STEP) + * Very important: This Matrix will only "borrow" this pointer, so the caller must make sure to maintain the + * memory allocated until this Matrix destructor is called and also to handle the ucharPtr memory deallocation. + * @param ucharPtr should be a cv::Mat::data (or analog) element or it will provoke a core dumped. Done to + * avoid explicitly exposing 3rdparty libraries on the headers. + */ + public Matrix(int rows, int cols, int type, Pointer cvMatPtr) { super((Pointer)null); allocate(rows, cols, type, cvMatPtr); } + private native void allocate(int rows, int cols, int type, Pointer cvMatPtr); + + public native @ByVal Matrix clone(); + + /** + * @return cv::Mat*. + */ + public native Pointer getCvMat(); + + /** + * @return const cv::Mat*. + */ + public native @Const Pointer getConstCvMat(); + + /** + * Equivalent to cv::Mat::data + * @return A raw pointer to the internal data of cv::Mat. + */ + public native @Cast("unsigned char*") BytePointer data(); + /** + * Equivalent to cv::Mat::data + * @return A raw pointer to the internal data of cv::Mat. + */ + public native @Cast("const unsigned char*") BytePointer dataConst(); + /** + * Similar to dataConst(), but it allows the data to be edited. + * This function is only implemented for Pybind11 usage. + * @return A raw pointer to the internal data of cv::Mat. + */ + public native @Cast("unsigned char*") BytePointer dataPseudoConst(); + + /** + * Equivalent to cv::Mat::eye + */ + public static native @ByVal Matrix eye(int rows, int cols, int type); + /** + * Equivalent to cv::Mat::cols + */ + public native int cols(); + /** + * Equivalent to cv::Mat::rows + */ + public native int rows(); + /** + * Equivalent to cv::Mat::size[dimension] + */ + public native int size(int dimension); + /** + * Equivalent to cv::Mat::dims + */ + public native int dims(); + + /** + * Equivalent to their analog cv::Mat functions + */ + public native @Cast("bool") boolean isContinuous(); + public native @Cast("bool") boolean isSubmatrix(); + public native @Cast("size_t") long elemSize(); + public native @Cast("size_t") long elemSize1(); + public native int type(); + public native int depth(); + public native int channels(); + public native @Cast("size_t") long step1(int i/*=0*/); + public native @Cast("size_t") long step1(); + public native @Cast("bool") boolean empty(); + public native @Cast("size_t") long total(); + public native int checkVector(int elemChannels, int depth/*=-1*/, @Cast("const bool") boolean requireContinuous/*=true*/); + public native int checkVector(int elemChannels); + + /** + * Similar to their analog cv::Mat functions + */ + public native void setTo(double value); + public native void copyTo(@ByRef Matrix outputMat); + } diff --git a/openpose/src/gen/java/org/bytedeco/openpose/OpString.java b/openpose/src/gen/java/org/bytedeco/openpose/OpString.java new file mode 100644 index 00000000000..a3365ed383e --- /dev/null +++ b/openpose/src/gen/java/org/bytedeco/openpose/OpString.java @@ -0,0 +1,65 @@ +// Targeted by JavaCPP version 1.5.4-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.openpose; + +import org.bytedeco.javacpp.annotation.Index; +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import static org.bytedeco.openblas.global.openblas_nolapack.*; +import static org.bytedeco.openblas.global.openblas.*; +import org.bytedeco.opencv.opencv_core.*; +import static org.bytedeco.opencv.global.opencv_core.*; +import org.bytedeco.opencv.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgcodecs.*; +import org.bytedeco.opencv.opencv_videoio.*; +import static org.bytedeco.opencv.global.opencv_videoio.*; +import org.bytedeco.opencv.opencv_highgui.*; +import static org.bytedeco.opencv.global.opencv_highgui.*; +import org.bytedeco.hdf5.*; +import static org.bytedeco.hdf5.global.hdf5.*; +import org.bytedeco.caffe.*; +import static org.bytedeco.caffe.global.caffe.*; + +import static org.bytedeco.openpose.global.openpose.*; + + /** + * String: Basic container for std::string to avoid std::string in the WrapperStructXXX classes. Otherwise, + * cryptic runtime DLL errors could occur when exporting OpenPose to other projects using different STL DLLs. + */ + @Name("op::String") @NoOffset @Properties(inherit = org.bytedeco.openpose.presets.openpose.class) +public class OpString extends Pointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public OpString(Pointer p) { super(p); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public OpString(long size) { super((Pointer)null); allocateArray(size); } + private native void allocateArray(long size); + @Override public OpString position(long position) { + return (OpString)super.position(position); + } + + public OpString() { super((Pointer)null); allocate(); } + private native void allocate(); + + /** + * It will force a copy of the char* of std::string to avoid DLL runtime errors. Example usages: + * std::string stdString = "This is a std::string"; + * String string(stdString.c_str()); + */ + public OpString(@Cast("const char*") BytePointer charPtr) { super((Pointer)null); allocate(charPtr); } + private native void allocate(@Cast("const char*") BytePointer charPtr); + public OpString(String charPtr) { super((Pointer)null); allocate(charPtr); } + private native void allocate(String charPtr); + + /** + * It will force a copy of string + */ + + public native @StdString BytePointer getStdString(); + + public native @Cast("bool") boolean empty(); + } diff --git a/openpose/src/gen/java/org/bytedeco/openpose/OpWrapper.java b/openpose/src/gen/java/org/bytedeco/openpose/OpWrapper.java new file mode 100644 index 00000000000..c3cb5009909 --- /dev/null +++ b/openpose/src/gen/java/org/bytedeco/openpose/OpWrapper.java @@ -0,0 +1,249 @@ +// Targeted by JavaCPP version 1.5.4-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.openpose; + +import org.bytedeco.javacpp.annotation.Index; +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import static org.bytedeco.openblas.global.openblas_nolapack.*; +import static org.bytedeco.openblas.global.openblas.*; +import org.bytedeco.opencv.opencv_core.*; +import static org.bytedeco.opencv.global.opencv_core.*; +import org.bytedeco.opencv.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgcodecs.*; +import org.bytedeco.opencv.opencv_videoio.*; +import static org.bytedeco.opencv.global.opencv_videoio.*; +import org.bytedeco.opencv.opencv_highgui.*; +import static org.bytedeco.opencv.global.opencv_highgui.*; +import org.bytedeco.hdf5.*; +import static org.bytedeco.hdf5.global.hdf5.*; +import org.bytedeco.caffe.*; +import static org.bytedeco.caffe.global.caffe.*; + +import static org.bytedeco.openpose.global.openpose.*; + + /** + * WrapperT: OpenPose all-in-one wrapper template class. Simplified into Wrapper for WrapperT> + * WrapperT allows the user to set up the input (video, webcam, custom input, etc.), pose, face and/or hands + * estimation and rendering, and output (integrated small GUI, custom output, etc.). + * + * This function can be used in 2 ways: + * - Synchronous mode: call the full constructor with your desired input and output workers. + * - Asynchronous mode: call the empty constructor WrapperT() + use the emplace and pop functions to push the + * original frames and retrieve the processed ones. + * - Mix of them: + * - Synchronous input + asynchronous output: call the constructor WrapperT(ThreadManagerMode::Synchronous, + * workersInput, {}, true) + * - Asynchronous input + synchronous output: call the constructor + * WrapperT(ThreadManagerMode::Synchronous, nullptr, workersOutput, irrelevantBoolean, true) + */ + @Name("op::WrapperT >,std::shared_ptr > >,std::shared_ptr > > > > >") @NoOffset @Properties(inherit = org.bytedeco.openpose.presets.openpose.class) +public class OpWrapper extends Pointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public OpWrapper(Pointer p) { super(p); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public OpWrapper(long size) { super((Pointer)null); allocateArray(size); } + private native void allocateArray(long size); + @Override public OpWrapper position(long position) { + return (OpWrapper)super.position(position); + } + + /** + * Constructor. + * @param threadManagerMode Thread syncronization mode. If set to ThreadManagerMode::Synchronous, everything + * will run inside the WrapperT. If ThreadManagerMode::Synchronous(In/Out), then input (frames producer) and/or + * output (GUI, writing results, etc.) will be controlled outside the WrapperT class by the user. See + * ThreadManagerMode for a detailed explanation of when to use each one. + */ + public OpWrapper(ThreadManagerMode threadManagerMode/*=op::ThreadManagerMode::Synchronous*/) { super((Pointer)null); allocate(threadManagerMode); } + private native void allocate(ThreadManagerMode threadManagerMode/*=op::ThreadManagerMode::Synchronous*/); + public OpWrapper() { super((Pointer)null); allocate(); } + private native void allocate(); + + /** + * Destructor. + * It automatically frees resources. + */ + + /** + * Disable multi-threading. + * Useful for debugging and logging, all the Workers will run in the same thread. + * Note that workerOnNewThread (argument for setWorker function) will not make any effect. + */ + public native void disableMultiThreading(); + + /** + * Add an user-defined extra Worker for a desired task (input, output, ...). + * @param workerType WorkerType to configure (e.g., Input, PreProcessing, PostProcessing, Output). + * @param worker TWorker to be added. + * @param workerOnNewThread Whether to add this TWorker on a new thread (if it is computationally demanding) or + * simply reuse existing threads (for light functions). Set to true if the performance time is unknown. + */ + public native void setWorker(WorkerType workerType, @Const @SharedPtr @ByRef DatumsWorker worker, @Cast("const bool") boolean workerOnNewThread/*=true*/); + public native void setWorker(WorkerType workerType, @Const @SharedPtr @ByRef DatumsWorker worker); + + /** + * It configures the pose parameters. Do not call for default values. + */ + public native void configure(@Const @ByRef WrapperStructPose wrapperStructPose); + + /** + * Analogous to configure(WrapperStructPose) but applied to face (WrapperStructFace) + */ + public native void configure(@Const @ByRef WrapperStructFace wrapperStructFace); + + /** + * Analogous to configure() but applied to hand (WrapperStructHand) + */ + public native void configure(@Const @ByRef WrapperStructHand wrapperStructHand); + + /** + * Analogous to configure() but applied to the extra options (WrapperStructExtra) + */ + public native void configure(@Const @ByRef WrapperStructExtra wrapperStructExtra); + + /** + * Analogous to configure() but applied to the input (WrapperStructInput) + */ + public native void configure(@Const @ByRef WrapperStructInput wrapperStructInput); + + /** + * Analogous to configure() but applied to the output (WrapperStructOutput) + */ + public native void configure(@Const @ByRef WrapperStructOutput wrapperStructOutput); + + /** + * Analogous to configure() but applied to the GUI (WrapperStructGui) + */ + public native void configure(@Const @ByRef WrapperStructGui wrapperStructGui); + + /** + * Function to start multi-threading. + * Similar to start(), but exec() blocks the thread that calls the function (it saves 1 thread). Use exec() + * instead of start() if the calling thread will otherwise be waiting for the WrapperT to end. + */ + public native void exec(); + + /** + * Function to start multi-threading. + * Similar to exec(), but start() does not block the thread that calls the function. It just opens new threads, + * so it lets the user perform other tasks meanwhile on the calling thread. + * VERY IMPORTANT NOTE: if the GUI is selected and OpenCV is compiled with Qt support, this option will not + * work. Qt needs the main thread to plot visual results, so the final GUI (which uses OpenCV) would return an + * exception similar to: {@code QMetaMethod::invoke: Unable to invoke methods with return values in queued + * connections}. Use exec() in that case. + */ + public native void start(); + + /** + * Function to stop multi-threading. + * It can be called internally or externally. + */ + public native void stop(); + + /** + * Whether the WrapperT is running. + * It will return true after exec() or start() and before stop(), and false otherwise. + * @return Boolean specifying whether the WrapperT is running. + */ + public native @Cast("bool") boolean isRunning(); + + /** + * It sets the maximum number of elements in the queue. + * For maximum speed, set to a very large number, but the trade-off would be: + * - Latency will hugely increase. + * - The program might go out of RAM memory (so the computer might freeze). + * For minimum latency while keeping an optimal speed, set to -1, that will automatically + * detect the ideal number based on how many elements are connected to that queue. + * @param defaultMaxSizeQueues long long element with the maximum number of elements on the queue. + */ + public native void setDefaultMaxSizeQueues(long defaultMaxSizeQueues/*=-1*/); + public native void setDefaultMaxSizeQueues(); + + /** + * Emplace (move) an element on the first (input) queue. + * Only valid if ThreadManagerMode::Asynchronous or ThreadManagerMode::AsynchronousIn. + * If the input queue is full or the WrapperT was stopped, it will return false and not emplace it. + * @param tDatums TDatumsSP element to be emplaced. + * @return Boolean specifying whether the tDatums could be emplaced. + */ + public native @Cast("bool") boolean tryEmplace(@SharedPtr @ByRef Datums tDatums); + + /** + * Emplace (move) an element on the first (input) queue. + * Similar to tryEmplace. + * However, if the input queue is full, it will wait until it can emplace it. + * If the WrapperT class is stopped before adding the element, it will return false and not emplace it. + * @param tDatums TDatumsSP element to be emplaced. + * @return Boolean specifying whether the tDatums could be emplaced. + */ + public native @Cast("bool") boolean waitAndEmplace(@SharedPtr @ByRef Datums tDatums); + + /** + * Similar to waitAndEmplace(const TDatumsSP& tDatums), but it takes a Matrix as input. + * @param matrix Matrix with the image to be processed. + * @return Boolean specifying whether the tDatums could be emplaced. + */ + public native @Cast("bool") boolean waitAndEmplace(@ByRef Matrix matrix); + + /** + * Push (copy) an element on the first (input) queue. + * Same as tryEmplace, but it copies the data instead of moving it. + * @param tDatums TDatumsSP element to be pushed. + * @return Boolean specifying whether the tDatums could be pushed. + */ + public native @Cast("bool") boolean tryPush(@Const @SharedPtr @ByRef Datums tDatums); + + /** + * Push (copy) an element on the first (input) queue. + * Same as waitAndEmplace, but it copies the data instead of moving it. + * @param tDatums TDatumsSP element to be pushed. + * @return Boolean specifying whether the tDatums could be pushed. + */ + public native @Cast("bool") boolean waitAndPush(@Const @SharedPtr @ByRef Datums tDatums); + + /** + * Similar to waitAndPush(const TDatumsSP& tDatums), but it takes a Matrix as input. + * @param matrix Matrix with the image to be processed. + * @return Boolean specifying whether the tDatums could be pushed. + */ + public native @Cast("bool") boolean waitAndPush(@Const @ByRef Matrix matrix); + + /** + * Pop (retrieve) an element from the last (output) queue. + * Only valid if ThreadManagerMode::Asynchronous or ThreadManagerMode::AsynchronousOut. + * If the output queue is empty or the WrapperT was stopped, it will return false and not retrieve it. + * @param tDatums TDatumsSP element where the retrieved element will be placed. + * @return Boolean specifying whether the tDatums could be retrieved. + */ + public native @Cast("bool") boolean tryPop(@SharedPtr @ByRef Datums tDatums); + + /** + * Pop (retrieve) an element from the last (output) queue. + * Similar to tryPop. + * However, if the output queue is empty, it will wait until it can pop an element. + * If the WrapperT class is stopped before popping the element, it will return false and not retrieve it. + * @param tDatums TDatumsSP element where the retrieved element will be placed. + * @return Boolean specifying whether the tDatums could be retrieved. + */ + public native @Cast("bool") boolean waitAndPop(@SharedPtr @ByRef Datums tDatums); + + /** + * Runs both waitAndEmplace and waitAndPop. + * @param tDatums TDatumsSP element where the retrieved element will be placed. + * @return Boolean specifying whether the tDatums could be retrieved. + */ + public native @Cast("bool") boolean emplaceAndPop(@SharedPtr @ByRef Datums tDatums); + + /** + * Similar to emplaceAndPop(TDatumsSP& tDatums), but it takes a Matrix as input. + * @param matrix Matrix with the image to be processed. + * @return TDatumsSP element where the processed information will be placed. + */ + public native @SharedPtr @ByVal Datums emplaceAndPop(@Const @ByRef Matrix matrix); + } diff --git a/openpose/src/gen/java/org/bytedeco/openpose/Producer.java b/openpose/src/gen/java/org/bytedeco/openpose/Producer.java new file mode 100644 index 00000000000..e0af06aea94 --- /dev/null +++ b/openpose/src/gen/java/org/bytedeco/openpose/Producer.java @@ -0,0 +1,144 @@ +// Targeted by JavaCPP version 1.5.4-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.openpose; + +import org.bytedeco.javacpp.annotation.Index; +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import static org.bytedeco.openblas.global.openblas_nolapack.*; +import static org.bytedeco.openblas.global.openblas.*; +import org.bytedeco.opencv.opencv_core.*; +import static org.bytedeco.opencv.global.opencv_core.*; +import org.bytedeco.opencv.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgcodecs.*; +import org.bytedeco.opencv.opencv_videoio.*; +import static org.bytedeco.opencv.global.opencv_videoio.*; +import org.bytedeco.opencv.opencv_highgui.*; +import static org.bytedeco.opencv.global.opencv_highgui.*; +import org.bytedeco.hdf5.*; +import static org.bytedeco.hdf5.global.hdf5.*; +import org.bytedeco.caffe.*; +import static org.bytedeco.caffe.global.caffe.*; + +import static org.bytedeco.openpose.global.openpose.*; + + /** + * Producer is an abstract class to extract frames from a source (image directory, video file, + * webcam stream, etc.). It has the basic and common functions (e.g., getFrame, release & isOpened). + */ + @Namespace("op") @NoOffset @Properties(inherit = org.bytedeco.openpose.presets.openpose.class) +public class Producer extends Pointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public Producer(Pointer p) { super(p); } + + /** + * Constructor of Producer. + */ + + /** + * Destructor of Producer. It is virtual so that any children class can implement + * its own destructor. + */ + + /** + * Main function of Producer, it retrieves and returns a new frame from the frames producer. + * @return Mat with the new frame. + */ + public native @ByVal Matrix getFrame(); + + /** + * Analogous to getFrame, but it could return > 1 frame. + * @return std::vector with the new frame(s). + */ + public native @StdVector Matrix getFrames(); + + /** + * It retrieves and returns the camera matrixes from the frames producer. + * Virtual class because FlirReader implements their own. + * @return std::vector with the camera matrices. + */ + public native @StdVector Matrix getCameraMatrices(); + + /** + * It retrieves and returns the camera extrinsic parameters from the frames producer. + * Virtual class because FlirReader implements their own. + * @return std::vector with the camera extrinsic parameters. + */ + public native @StdVector Matrix getCameraExtrinsics(); + + /** + * It retrieves and returns the camera intrinsic parameters from the frames producer. + * Virtual class because FlirReader implements their own. + * @return std::vector with the camera intrinsic parameters. + */ + public native @StdVector Matrix getCameraIntrinsics(); + + /** + * This function returns a unique frame name (e.g., the frame number for video, the + * frame counter for webcam, the image name for image directory reader, etc.). + * @return std::string with an unique frame name. + */ + public native @StdString BytePointer getNextFrameName(); + + /** + * This function sets whether the producer must keep the original fps frame rate or extract the frames as quick + * as possible. + * @param fpsMode ProducerFpsMode parameter specifying the new value. + */ + public native void setProducerFpsMode(ProducerFpsMode fpsMode); + + /** + * This function returns the type of producer (video, webcam, ...). + * @return ProducerType with the kind of producer. + */ + public native ProducerType getType(); + + /** + * This function returns whether the Producer instance is still opened and able + * to retrieve more frames. + * @return bool indicating whether the Producer is opened. + */ + public native @Cast("bool") boolean isOpened(); + + /** + * This function releases and closes the Producer. After it is called, no more frames + * can be retrieved from Producer::getFrames. + */ + public native void release(); + + /** + * This function is a wrapper of cv::VideoCapture::get. It allows getting different properties + * of the Producer (fps, width, height, etc.). See the OpenCV documentation for all the + * available properties. + * @param capProperty int indicating the property to be modified. + * @return double returning the property value. + */ + public native double get(int capProperty); + + /** + * This function is a wrapper of cv::VideoCapture::set. It allows setting different properties + * of the Producer (fps, width, height, etc.). See the OpenCV documentation for all the + * available properties. + * @param capProperty int indicating the property to be modified. + * @param value double indicating the new value to be assigned. + */ + public native void set(int capProperty, double value); + + /** + * Extra attributes that VideoCapture::get/set do not contain. + * @param property ProducerProperty indicating the property to be modified. + */ + public native double get(ProducerProperty property); + + /** + * Extra attributes that VideoCapture::get/set do not contain. + * @param property ProducerProperty indicating the property to be modified. + * @param value double indicating the new value to be assigned. + */ + public native void set(ProducerProperty property, double value); + } diff --git a/openpose/src/gen/java/org/bytedeco/openpose/ProducerOpStringPair.java b/openpose/src/gen/java/org/bytedeco/openpose/ProducerOpStringPair.java new file mode 100644 index 00000000000..71882d6ee09 --- /dev/null +++ b/openpose/src/gen/java/org/bytedeco/openpose/ProducerOpStringPair.java @@ -0,0 +1,49 @@ +// Targeted by JavaCPP version 1.5.4-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.openpose; + +import org.bytedeco.javacpp.annotation.Index; +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import static org.bytedeco.openblas.global.openblas_nolapack.*; +import static org.bytedeco.openblas.global.openblas.*; +import org.bytedeco.opencv.opencv_core.*; +import static org.bytedeco.opencv.global.opencv_core.*; +import org.bytedeco.opencv.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgcodecs.*; +import org.bytedeco.opencv.opencv_videoio.*; +import static org.bytedeco.opencv.global.opencv_videoio.*; +import org.bytedeco.opencv.opencv_highgui.*; +import static org.bytedeco.opencv.global.opencv_highgui.*; +import org.bytedeco.hdf5.*; +import static org.bytedeco.hdf5.global.hdf5.*; +import org.bytedeco.caffe.*; +import static org.bytedeco.caffe.global.caffe.*; + +import static org.bytedeco.openpose.global.openpose.*; + +@NoOffset @Name("std::pair") @Properties(inherit = org.bytedeco.openpose.presets.openpose.class) +public class ProducerOpStringPair extends Pointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public ProducerOpStringPair(Pointer p) { super(p); } + public ProducerOpStringPair(ProducerType firstValue, OpString secondValue) { this(); put(firstValue, secondValue); } + public ProducerOpStringPair() { allocate(); } + private native void allocate(); + public native @Name("operator =") @ByRef ProducerOpStringPair put(@ByRef ProducerOpStringPair x); + + + @MemberGetter public native @ByRef ProducerType first(); public native ProducerOpStringPair first(ProducerType first); + @MemberGetter public native @ByRef OpString second(); public native ProducerOpStringPair second(OpString second); + + public ProducerOpStringPair put(ProducerType firstValue, OpString secondValue) { + first(firstValue); + second(secondValue); + return this; + } +} + diff --git a/openpose/src/gen/java/org/bytedeco/openpose/WrapperStructExtra.java b/openpose/src/gen/java/org/bytedeco/openpose/WrapperStructExtra.java new file mode 100644 index 00000000000..ee67bed37e8 --- /dev/null +++ b/openpose/src/gen/java/org/bytedeco/openpose/WrapperStructExtra.java @@ -0,0 +1,93 @@ +// Targeted by JavaCPP version 1.5.4-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.openpose; + +import org.bytedeco.javacpp.annotation.Index; +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import static org.bytedeco.openblas.global.openblas_nolapack.*; +import static org.bytedeco.openblas.global.openblas.*; +import org.bytedeco.opencv.opencv_core.*; +import static org.bytedeco.opencv.global.opencv_core.*; +import org.bytedeco.opencv.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgcodecs.*; +import org.bytedeco.opencv.opencv_videoio.*; +import static org.bytedeco.opencv.global.opencv_videoio.*; +import org.bytedeco.opencv.opencv_highgui.*; +import static org.bytedeco.opencv.global.opencv_highgui.*; +import org.bytedeco.hdf5.*; +import static org.bytedeco.hdf5.global.hdf5.*; +import org.bytedeco.caffe.*; +import static org.bytedeco.caffe.global.caffe.*; + +import static org.bytedeco.openpose.global.openpose.*; + + /** + * WrapperStructExtra: Pose estimation and rendering configuration struct. + * WrapperStructExtra allows the user to set up the pose estimation and rendering parameters that will be used for + * the OpenPose WrapperT template and Wrapper class. + */ + @Namespace("op") @NoOffset @Properties(inherit = org.bytedeco.openpose.presets.openpose.class) +public class WrapperStructExtra extends Pointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public WrapperStructExtra(Pointer p) { super(p); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public WrapperStructExtra(long size) { super((Pointer)null); allocateArray(size); } + private native void allocateArray(long size); + @Override public WrapperStructExtra position(long position) { + return (WrapperStructExtra)super.position(position); + } + + /** + * Whether to run the 3-D reconstruction demo, i.e., + * 1) Reading from a stereo camera system. + * 2) Performing 3-D reconstruction from the multiple views. + * 3) Displaying 3-D reconstruction results. + */ + public native @Cast("bool") boolean reconstruct3d(); public native WrapperStructExtra reconstruct3d(boolean setter); + + /** + * Minimum number of views required to reconstruct each keypoint. + * By default (-1), it will require max(2, min(4, #cameras-1)) cameras to see the keypoint in order to + * reconstruct it. + */ + public native int minViews3d(); public native WrapperStructExtra minViews3d(int setter); + + /** + * Whether to return a person ID for each body skeleton, providing temporal consistency. + */ + public native @Cast("bool") boolean identification(); public native WrapperStructExtra identification(boolean setter); + + /** + * Whether to enable people tracking across frames. The value indicates the number of frames where tracking + * is run between each OpenPose keypoint detection. Select -1 (default) to disable it or 0 to run + * simultaneously OpenPose keypoint detector and tracking for potentially higher accurary than only OpenPose. + */ + public native int tracking(); public native WrapperStructExtra tracking(int setter); + + /** + * Whether to enable inverse kinematics (IK) from 3-D keypoints to obtain 3-D joint angles. By default + * (0 threads), it is disabled. Increasing the number of threads will increase the speed but also the + * global system latency. + */ + public native int ikThreads(); public native WrapperStructExtra ikThreads(int setter); + + /** + * Constructor of the struct. + * It has the recommended and default values we recommend for each element of the struct. + * Since all the elements of the struct are public, they can also be manually filled. + */ + public WrapperStructExtra( + @Cast("const bool") boolean reconstruct3d/*=false*/, int minViews3d/*=-1*/, @Cast("const bool") boolean identification/*=false*/, + int tracking/*=-1*/, int ikThreads/*=0*/) { super((Pointer)null); allocate(reconstruct3d, minViews3d, identification, tracking, ikThreads); } + private native void allocate( + @Cast("const bool") boolean reconstruct3d/*=false*/, int minViews3d/*=-1*/, @Cast("const bool") boolean identification/*=false*/, + int tracking/*=-1*/, int ikThreads/*=0*/); + public WrapperStructExtra() { super((Pointer)null); allocate(); } + private native void allocate(); + } diff --git a/openpose/src/gen/java/org/bytedeco/openpose/WrapperStructFace.java b/openpose/src/gen/java/org/bytedeco/openpose/WrapperStructFace.java new file mode 100644 index 00000000000..ac363f3749a --- /dev/null +++ b/openpose/src/gen/java/org/bytedeco/openpose/WrapperStructFace.java @@ -0,0 +1,109 @@ +// Targeted by JavaCPP version 1.5.4-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.openpose; + +import org.bytedeco.javacpp.annotation.Index; +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import static org.bytedeco.openblas.global.openblas_nolapack.*; +import static org.bytedeco.openblas.global.openblas.*; +import org.bytedeco.opencv.opencv_core.*; +import static org.bytedeco.opencv.global.opencv_core.*; +import org.bytedeco.opencv.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgcodecs.*; +import org.bytedeco.opencv.opencv_videoio.*; +import static org.bytedeco.opencv.global.opencv_videoio.*; +import org.bytedeco.opencv.opencv_highgui.*; +import static org.bytedeco.opencv.global.opencv_highgui.*; +import org.bytedeco.hdf5.*; +import static org.bytedeco.hdf5.global.hdf5.*; +import org.bytedeco.caffe.*; +import static org.bytedeco.caffe.global.caffe.*; + +import static org.bytedeco.openpose.global.openpose.*; + + /** + * WrapperStructFace: Face estimation and rendering configuration struct. + * WrapperStructFace allows the user to set up the face estimation and rendering parameters that will be used for + * the OpenPose WrapperT template and Wrapper class. + */ + @Namespace("op") @NoOffset @Properties(inherit = org.bytedeco.openpose.presets.openpose.class) +public class WrapperStructFace extends Pointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public WrapperStructFace(Pointer p) { super(p); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public WrapperStructFace(long size) { super((Pointer)null); allocateArray(size); } + private native void allocateArray(long size); + @Override public WrapperStructFace position(long position) { + return (WrapperStructFace)super.position(position); + } + + /** + * Whether to extract face. + */ + public native @Cast("bool") boolean enable(); public native WrapperStructFace enable(boolean setter); + + /** + * Kind of face rectangle detector. Recommended Detector::Body (fastest one if body is enabled and most + * accurate one), which is based on the OpenPose body keypoint detector. + */ + public native Detector detector(); public native WrapperStructFace detector(Detector setter); + + /** + * CCN (Conv Net) input size. + * The greater, the slower and more memory it will be needed, but it will potentially increase accuracy. + * Both width and height must be divisible by 16. + */ + public native @ByRef IntPoint netInputSize(); public native WrapperStructFace netInputSize(IntPoint setter); + + /** + * Whether to render the output (pose locations, body, background or PAF heat maps) with CPU or GPU. + * Select {@code None} for no rendering, {@code Cpu} or {@code Gpu} por CPU and GPU rendering respectively. + */ + public native RenderMode renderMode(); public native WrapperStructFace renderMode(RenderMode setter); + + /** + * Rendering blending alpha value of the pose point locations with respect to the background image. + * Value in the range [0, 1]. 0 will only render the background, 1 will fully render the pose. + */ + public native float alphaKeypoint(); public native WrapperStructFace alphaKeypoint(float setter); + + /** + * Rendering blending alpha value of the heat maps (face part, background or PAF) with respect to the + * background image. + * Value in the range [0, 1]. 0 will only render the background, 1 will only render the heat map. + */ + public native float alphaHeatMap(); public native WrapperStructFace alphaHeatMap(float setter); + + /** + * Rendering threshold. Only estimated keypoints whose score confidences are higher than this value will be + * rendered. Note: Rendered refers only to visual display in the OpenPose basic GUI, not in the saved results. + * Generally, a high threshold (> 0.5) will only render very clear body parts; while small thresholds + * (~0.1) will also output guessed and occluded keypoints, but also more false positives (i.e., wrong + * detections). + */ + public native float renderThreshold(); public native WrapperStructFace renderThreshold(float setter); + + /** + * Constructor of the struct. + * It has the recommended and default values we recommend for each element of the struct. + * Since all the elements of the struct are public, they can also be manually filled. + */ + public WrapperStructFace( + @Cast("const bool") boolean enable/*=false*/, Detector detector/*=op::Detector::Body*/, + @Const @ByRef(nullValue = "op::Point{368, 368}") IntPoint netInputSize, RenderMode renderMode/*=op::RenderMode::Auto*/, + float alphaKeypoint/*=FACE_DEFAULT_ALPHA_KEYPOINT*/, + float alphaHeatMap/*=FACE_DEFAULT_ALPHA_HEAT_MAP*/, float renderThreshold/*=0.4f*/) { super((Pointer)null); allocate(enable, detector, netInputSize, renderMode, alphaKeypoint, alphaHeatMap, renderThreshold); } + private native void allocate( + @Cast("const bool") boolean enable/*=false*/, Detector detector/*=op::Detector::Body*/, + @Const @ByRef(nullValue = "op::Point{368, 368}") IntPoint netInputSize, RenderMode renderMode/*=op::RenderMode::Auto*/, + float alphaKeypoint/*=FACE_DEFAULT_ALPHA_KEYPOINT*/, + float alphaHeatMap/*=FACE_DEFAULT_ALPHA_HEAT_MAP*/, float renderThreshold/*=0.4f*/); + public WrapperStructFace() { super((Pointer)null); allocate(); } + private native void allocate(); + } diff --git a/openpose/src/gen/java/org/bytedeco/openpose/WrapperStructGui.java b/openpose/src/gen/java/org/bytedeco/openpose/WrapperStructGui.java new file mode 100644 index 00000000000..11e43a22d70 --- /dev/null +++ b/openpose/src/gen/java/org/bytedeco/openpose/WrapperStructGui.java @@ -0,0 +1,80 @@ +// Targeted by JavaCPP version 1.5.4-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.openpose; + +import org.bytedeco.javacpp.annotation.Index; +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import static org.bytedeco.openblas.global.openblas_nolapack.*; +import static org.bytedeco.openblas.global.openblas.*; +import org.bytedeco.opencv.opencv_core.*; +import static org.bytedeco.opencv.global.opencv_core.*; +import org.bytedeco.opencv.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgcodecs.*; +import org.bytedeco.opencv.opencv_videoio.*; +import static org.bytedeco.opencv.global.opencv_videoio.*; +import org.bytedeco.opencv.opencv_highgui.*; +import static org.bytedeco.opencv.global.opencv_highgui.*; +import org.bytedeco.hdf5.*; +import static org.bytedeco.hdf5.global.hdf5.*; +import org.bytedeco.caffe.*; +import static org.bytedeco.caffe.global.caffe.*; + +import static org.bytedeco.openpose.global.openpose.*; + + /** + * WrapperStructGui: It controls a small GUI for quick visualization. + */ + @Namespace("op") @NoOffset @Properties(inherit = org.bytedeco.openpose.presets.openpose.class) +public class WrapperStructGui extends Pointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public WrapperStructGui(Pointer p) { super(p); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public WrapperStructGui(long size) { super((Pointer)null); allocateArray(size); } + private native void allocateArray(long size); + @Override public WrapperStructGui position(long position) { + return (WrapperStructGui)super.position(position); + } + + /** + * Display mode + * a) -1 for automatic selection. + * b) 0 for no display. Useful if there is no X server and/or to slightly speed up the processing if visual + * output is not required. + * c) 2 for 2-D display in the OpenPose small integrated GUI. + * d) 3 for 3-D display, if {@code --3d} was enabled. + * e) 1 for both 2-D and 3-D display. + */ + public native DisplayMode displayMode(); public native WrapperStructGui displayMode(DisplayMode setter); + + /** + * Whether to add some information to the frame (number of frame, number people detected, etc.) after it is + * saved on disk and before it is displayed and/or returned to the user. + */ + public native @Cast("bool") boolean guiVerbose(); public native WrapperStructGui guiVerbose(boolean setter); + + /** + * Whether to display the OpenPose small integrated GUI on fullscreen mode. It can be changed by interacting + * with the GUI itself. + */ + public native @Cast("bool") boolean fullScreen(); public native WrapperStructGui fullScreen(boolean setter); + + /** + * Constructor of the struct. + * It has the recommended and default values we recommend for each element of the struct. + * Since all the elements of the struct are public, they can also be manually filled. + */ + public WrapperStructGui( + DisplayMode displayMode/*=op::DisplayMode::NoDisplay*/, @Cast("const bool") boolean guiVerbose/*=false*/, + @Cast("const bool") boolean fullScreen/*=false*/) { super((Pointer)null); allocate(displayMode, guiVerbose, fullScreen); } + private native void allocate( + DisplayMode displayMode/*=op::DisplayMode::NoDisplay*/, @Cast("const bool") boolean guiVerbose/*=false*/, + @Cast("const bool") boolean fullScreen/*=false*/); + public WrapperStructGui() { super((Pointer)null); allocate(); } + private native void allocate(); + } diff --git a/openpose/src/gen/java/org/bytedeco/openpose/WrapperStructHand.java b/openpose/src/gen/java/org/bytedeco/openpose/WrapperStructHand.java new file mode 100644 index 00000000000..6c1c555aafb --- /dev/null +++ b/openpose/src/gen/java/org/bytedeco/openpose/WrapperStructHand.java @@ -0,0 +1,130 @@ +// Targeted by JavaCPP version 1.5.4-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.openpose; + +import org.bytedeco.javacpp.annotation.Index; +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import static org.bytedeco.openblas.global.openblas_nolapack.*; +import static org.bytedeco.openblas.global.openblas.*; +import org.bytedeco.opencv.opencv_core.*; +import static org.bytedeco.opencv.global.opencv_core.*; +import org.bytedeco.opencv.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgcodecs.*; +import org.bytedeco.opencv.opencv_videoio.*; +import static org.bytedeco.opencv.global.opencv_videoio.*; +import org.bytedeco.opencv.opencv_highgui.*; +import static org.bytedeco.opencv.global.opencv_highgui.*; +import org.bytedeco.hdf5.*; +import static org.bytedeco.hdf5.global.hdf5.*; +import org.bytedeco.caffe.*; +import static org.bytedeco.caffe.global.caffe.*; + +import static org.bytedeco.openpose.global.openpose.*; + + /** + * WrapperStructHand: Hand estimation and rendering configuration struct. + * WrapperStructHand allows the user to set up the hand estimation and rendering parameters that will be used for + * the OpenPose WrapperT template and Wrapper class. + */ + @Namespace("op") @NoOffset @Properties(inherit = org.bytedeco.openpose.presets.openpose.class) +public class WrapperStructHand extends Pointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public WrapperStructHand(Pointer p) { super(p); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public WrapperStructHand(long size) { super((Pointer)null); allocateArray(size); } + private native void allocateArray(long size); + @Override public WrapperStructHand position(long position) { + return (WrapperStructHand)super.position(position); + } + + /** + * Whether to extract hand. + */ + public native @Cast("bool") boolean enable(); public native WrapperStructHand enable(boolean setter); + + /** + * Kind of hand rectangle detector. Recommended Detector::Body (fastest one if body is enabled and most + * accurate one), which is based on the OpenPose body keypoint detector. + * For hand, there is the alternative of Detector::BodyWithTracking. If selected, it will add tracking + * between frames. Adding hand tracking might improve hand keypoints detection for webcam (if the frame + * rate is high enough, i.e., >7 FPS per GPU) and video. This is not person ID tracking, it simply looks + * for hands in positions at which hands were located in previous frames, but it does not guarantee the + * same person id among frames. + */ + public native Detector detector(); public native WrapperStructHand detector(Detector setter); + + /** + * CCN (Conv Net) input size. + * The greater, the slower and more memory it will be needed, but it will potentially increase accuracy. + * Both width and height must be divisible by 16. + */ + public native @ByRef IntPoint netInputSize(); public native WrapperStructHand netInputSize(IntPoint setter); + + /** + * Number of scales to process. + * The greater, the slower and more memory it will be needed, but it will potentially increase accuracy. + * This parameter is related with scaleRange, such as the final pose estimation will be an average of the + * predicted results for each scale. + */ + public native int scalesNumber(); public native WrapperStructHand scalesNumber(int setter); + + /** + * Total range between smallest and biggest scale. The scales will be centered in ratio 1. E.g., if + * scaleRange = 0.4 and scalesNumber = 2, then there will be 2 scales, 0.8 and 1.2. + */ + public native float scaleRange(); public native WrapperStructHand scaleRange(float setter); + + /** + * Whether to render the output (pose locations, body, background or PAF heat maps) with CPU or GPU. + * Select {@code None} for no rendering, {@code Cpu} or {@code Gpu} por CPU and GPU rendering respectively. + */ + public native RenderMode renderMode(); public native WrapperStructHand renderMode(RenderMode setter); + + /** + * Rendering blending alpha value of the pose point locations with respect to the background image. + * Value in the range [0, 1]. 0 will only render the background, 1 will fully render the pose. + */ + public native float alphaKeypoint(); public native WrapperStructHand alphaKeypoint(float setter); + + /** + * Rendering blending alpha value of the heat maps (hand part, background or PAF) with respect to the + * background image. + * Value in the range [0, 1]. 0 will only render the background, 1 will only render the heat map. + */ + public native float alphaHeatMap(); public native WrapperStructHand alphaHeatMap(float setter); + + /** + * Rendering threshold. Only estimated keypoints whose score confidences are higher than this value will be + * rendered. Note: Rendered refers only to visual display in the OpenPose basic GUI, not in the saved results. + * Generally, a high threshold (> 0.5) will only render very clear body parts; while small thresholds + * (~0.1) will also output guessed and occluded keypoints, but also more false positives (i.e., wrong + * detections). + */ + public native float renderThreshold(); public native WrapperStructHand renderThreshold(float setter); + + /** + * Constructor of the struct. + * It has the recommended and default values we recommend for each element of the struct. + * Since all the elements of the struct are public, they can also be manually filled. + */ + public WrapperStructHand( + @Cast("const bool") boolean enable/*=false*/, Detector detector/*=op::Detector::Body*/, + @Const @ByRef(nullValue = "op::Point{368, 368}") IntPoint netInputSize, int scalesNumber/*=1*/, + float scaleRange/*=0.4f*/, RenderMode renderMode/*=op::RenderMode::Auto*/, + float alphaKeypoint/*=HAND_DEFAULT_ALPHA_KEYPOINT*/, + float alphaHeatMap/*=HAND_DEFAULT_ALPHA_HEAT_MAP*/, float renderThreshold/*=0.2f*/) { super((Pointer)null); allocate(enable, detector, netInputSize, scalesNumber, scaleRange, renderMode, alphaKeypoint, alphaHeatMap, renderThreshold); } + private native void allocate( + @Cast("const bool") boolean enable/*=false*/, Detector detector/*=op::Detector::Body*/, + @Const @ByRef(nullValue = "op::Point{368, 368}") IntPoint netInputSize, int scalesNumber/*=1*/, + float scaleRange/*=0.4f*/, RenderMode renderMode/*=op::RenderMode::Auto*/, + float alphaKeypoint/*=HAND_DEFAULT_ALPHA_KEYPOINT*/, + float alphaHeatMap/*=HAND_DEFAULT_ALPHA_HEAT_MAP*/, float renderThreshold/*=0.2f*/); + public WrapperStructHand() { super((Pointer)null); allocate(); } + private native void allocate(); + } diff --git a/openpose/src/gen/java/org/bytedeco/openpose/WrapperStructInput.java b/openpose/src/gen/java/org/bytedeco/openpose/WrapperStructInput.java new file mode 100644 index 00000000000..d648151a17b --- /dev/null +++ b/openpose/src/gen/java/org/bytedeco/openpose/WrapperStructInput.java @@ -0,0 +1,146 @@ +// Targeted by JavaCPP version 1.5.4-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.openpose; + +import org.bytedeco.javacpp.annotation.Index; +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import static org.bytedeco.openblas.global.openblas_nolapack.*; +import static org.bytedeco.openblas.global.openblas.*; +import org.bytedeco.opencv.opencv_core.*; +import static org.bytedeco.opencv.global.opencv_core.*; +import org.bytedeco.opencv.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgcodecs.*; +import org.bytedeco.opencv.opencv_videoio.*; +import static org.bytedeco.opencv.global.opencv_videoio.*; +import org.bytedeco.opencv.opencv_highgui.*; +import static org.bytedeco.opencv.global.opencv_highgui.*; +import org.bytedeco.hdf5.*; +import static org.bytedeco.hdf5.global.hdf5.*; +import org.bytedeco.caffe.*; +import static org.bytedeco.caffe.global.caffe.*; + +import static org.bytedeco.openpose.global.openpose.*; + + /** + * WrapperStructInput: Input (images, video, webcam, etc.) configuration struct. + * WrapperStructInput allows the user to set up the input frames generator. + */ + @Namespace("op") @NoOffset @Properties(inherit = org.bytedeco.openpose.presets.openpose.class) +public class WrapperStructInput extends Pointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public WrapperStructInput(Pointer p) { super(p); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public WrapperStructInput(long size) { super((Pointer)null); allocateArray(size); } + private native void allocateArray(long size); + @Override public WrapperStructInput position(long position) { + return (WrapperStructInput)super.position(position); + } + + /** + * Desired type of producer (FlirCamera, ImageDirectory, IPCamera, Video, Webcam, None, etc.). + * Default: ProducerType::None. + */ + public native ProducerType producerType(); public native WrapperStructInput producerType(ProducerType setter); + + /** + * Path of the producer (image directory path for ImageDirectory, video path for Video, + * camera index for Webcam and FlirCamera, URL for IPCamera, etc.). + * Default: "". + */ + public native @ByRef OpString producerString(); public native WrapperStructInput producerString(OpString setter); + + /** + * First image to process. + * Default: 0. + */ + public native @Cast("unsigned long long") long frameFirst(); public native WrapperStructInput frameFirst(long setter); + + /** + * Step or gap across processed frames. + * Default: 1 (i.e., process all frames). + * Example: A value of 5 would mean to process frames 0, 5, 10, etc. + */ + public native @Cast("unsigned long long") long frameStep(); public native WrapperStructInput frameStep(long setter); + + /** + * Last image to process. + * Default: -1 (i.e., process all frames). + */ + public native @Cast("unsigned long long") long frameLast(); public native WrapperStructInput frameLast(long setter); + + /** + * Whether to skip or sleep in order to keep the same FPS as the frames producer. + */ + public native @Cast("bool") boolean realTimeProcessing(); public native WrapperStructInput realTimeProcessing(boolean setter); + + /** + * Whether to flip (mirror) the image. + */ + public native @Cast("bool") boolean frameFlip(); public native WrapperStructInput frameFlip(boolean setter); + + /** + * Image rotation. + * Only 4 possible values: 0 (default, no rotation), 90, 180 or 270 degrees + */ + public native int frameRotate(); public native WrapperStructInput frameRotate(int setter); + + /** + * Whether to re-open the producer if it reaches the end (e.g., video or image directory after the last frame). + */ + public native @Cast("bool") boolean framesRepeat(); public native WrapperStructInput framesRepeat(boolean setter); + + /** + * Camera resolution (only for Webcam and FlirCamera). + */ + public native @ByRef IntPoint cameraResolution(); public native WrapperStructInput cameraResolution(IntPoint setter); + + /** + * Directory path for the camera parameters (intrinsic and extrinsic parameters) or optionally XML file + * full path (if only 1 view). + */ + public native @ByRef OpString cameraParameterPath(); public native WrapperStructInput cameraParameterPath(OpString setter); + + /** + * Whether to undistort the image given the camera parameters. + */ + public native @Cast("bool") boolean undistortImage(); public native WrapperStructInput undistortImage(boolean setter); + + /** + * Number of camera views. + * Complementary option for {@code --image_dir} or {@code --video} + * It is -1 for Flir cameras (# cameras detected at runtime), as well as for any other frames source (-1 and 1 + * are equivalent for those). It could be greater than 1 only for prerecorded produced sources, such as video + * and image directory. + */ + public native int numberViews(); public native WrapperStructInput numberViews(int setter); + + /** + * Constructor of the struct. + * It has the recommended and default values we recommend for each element of the struct. + * Since all the elements of the struct are public, they can also be manually filled. + */ + public WrapperStructInput( + ProducerType producerType/*=op::ProducerType::None*/, @Const @ByRef(nullValue = "op::String(\"\")") OpString producerString, + @Cast("const unsigned long long") long frameFirst/*=0*/, @Cast("const unsigned long long") long frameStep/*=1*/, + @Cast("const unsigned long long") long frameLast/*=std::numeric_limits::max()*/, + @Cast("const bool") boolean realTimeProcessing/*=false*/, @Cast("const bool") boolean frameFlip/*=false*/, int frameRotate/*=0*/, + @Cast("const bool") boolean framesRepeat/*=false*/, @Const @ByRef(nullValue = "op::Point{-1,-1}") IntPoint cameraResolution, + @Const @ByRef(nullValue = "op::String(\"models/cameraParameters/\")") OpString cameraParameterPath, + @Cast("const bool") boolean undistortImage/*=false*/, int numberViews/*=-1*/) { super((Pointer)null); allocate(producerType, producerString, frameFirst, frameStep, frameLast, realTimeProcessing, frameFlip, frameRotate, framesRepeat, cameraResolution, cameraParameterPath, undistortImage, numberViews); } + private native void allocate( + ProducerType producerType/*=op::ProducerType::None*/, @Const @ByRef(nullValue = "op::String(\"\")") OpString producerString, + @Cast("const unsigned long long") long frameFirst/*=0*/, @Cast("const unsigned long long") long frameStep/*=1*/, + @Cast("const unsigned long long") long frameLast/*=std::numeric_limits::max()*/, + @Cast("const bool") boolean realTimeProcessing/*=false*/, @Cast("const bool") boolean frameFlip/*=false*/, int frameRotate/*=0*/, + @Cast("const bool") boolean framesRepeat/*=false*/, @Const @ByRef(nullValue = "op::Point{-1,-1}") IntPoint cameraResolution, + @Const @ByRef(nullValue = "op::String(\"models/cameraParameters/\")") OpString cameraParameterPath, + @Cast("const bool") boolean undistortImage/*=false*/, int numberViews/*=-1*/); + public WrapperStructInput() { super((Pointer)null); allocate(); } + private native void allocate(); + } diff --git a/openpose/src/gen/java/org/bytedeco/openpose/WrapperStructOutput.java b/openpose/src/gen/java/org/bytedeco/openpose/WrapperStructOutput.java new file mode 100644 index 00000000000..d989ab62674 --- /dev/null +++ b/openpose/src/gen/java/org/bytedeco/openpose/WrapperStructOutput.java @@ -0,0 +1,203 @@ +// Targeted by JavaCPP version 1.5.4-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.openpose; + +import org.bytedeco.javacpp.annotation.Index; +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import static org.bytedeco.openblas.global.openblas_nolapack.*; +import static org.bytedeco.openblas.global.openblas.*; +import org.bytedeco.opencv.opencv_core.*; +import static org.bytedeco.opencv.global.opencv_core.*; +import org.bytedeco.opencv.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgcodecs.*; +import org.bytedeco.opencv.opencv_videoio.*; +import static org.bytedeco.opencv.global.opencv_videoio.*; +import org.bytedeco.opencv.opencv_highgui.*; +import static org.bytedeco.opencv.global.opencv_highgui.*; +import org.bytedeco.hdf5.*; +import static org.bytedeco.hdf5.global.hdf5.*; +import org.bytedeco.caffe.*; +import static org.bytedeco.caffe.global.caffe.*; + +import static org.bytedeco.openpose.global.openpose.*; + + /** + * WrapperStructOutput: Output ( writing rendered results and/or pose data, etc.) configuration struct. + */ + @Namespace("op") @NoOffset @Properties(inherit = org.bytedeco.openpose.presets.openpose.class) +public class WrapperStructOutput extends Pointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public WrapperStructOutput(Pointer p) { super(p); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public WrapperStructOutput(long size) { super((Pointer)null); allocateArray(size); } + private native void allocateArray(long size); + @Override public WrapperStructOutput position(long position) { + return (WrapperStructOutput)super.position(position); + } + + /** + * Output verbose in the command line. + * If -1, it will be disabled (default). If it is a positive integer number, it will print on" + * the command line every {@code verbose} frames. If number in the range (0,1), it will print the" + * progress every {@code verbose} times the total of frames. + */ + public native double verbose(); public native WrapperStructOutput verbose(double setter); + + /** + * Pose (x, y, score) locations saving folder location. + * If it is empty (default), it is disabled. + * Select format with writeKeypointFormat. + */ + public native @ByRef OpString writeKeypoint(); public native WrapperStructOutput writeKeypoint(OpString setter); + + /** + * Data format to save Pose (x, y, score) locations. + * Options: DataFormat::Json (default), DataFormat::Xml and DataFormat::Yml (equivalent to DataFormat::Yaml) + * JSON option only available for OpenCV >= 3.0. + */ + public native DataFormat writeKeypointFormat(); public native WrapperStructOutput writeKeypointFormat(DataFormat setter); + + /** + * Directory to write OpenPose output in JSON format. + * If it is empty (default), it is disabled. + * It includes: + * - {@code people} field with body, hand, and face pose keypoints in (x, y, score) format. + * - {@code part_candidates} field with body part candidates in (x, y, score) format (if enabled with + * {@code --part_candidates}). + */ + public native @ByRef OpString writeJson(); public native WrapperStructOutput writeJson(OpString setter); + + /** + * Pose (x, y, score) locations saving folder location in JSON COCO validation format. + * If it is empty (default), it is disabled. + */ + public native @ByRef OpString writeCocoJson(); public native WrapperStructOutput writeCocoJson(OpString setter); + + /** + * It selects the COCO variants for cocoJsonSaver. + * Add 1 for body, add 2 for foot, 4 for face, and/or 8 for hands. Use 0 to use all the possible candidates. + * E.g., 7 would mean body+foot+face COCO JSON.. + */ + public native int writeCocoJsonVariants(); public native WrapperStructOutput writeCocoJsonVariants(int setter); + + /** + * Experimental option (only makes effect on car JSON generation). + * It selects the COCO variant for cocoJsonSaver. + */ + public native int writeCocoJsonVariant(); public native WrapperStructOutput writeCocoJsonVariant(int setter); + + /** + * Rendered image saving folder. + * If it is empty (default), it is disabled. + */ + public native @ByRef OpString writeImages(); public native WrapperStructOutput writeImages(OpString setter); + + /** + * Rendered image saving folder format. + * Check your OpenCV version documentation for a list of compatible formats. + * E.g., png, jpg, etc. + * If writeImages is empty (default), it makes no effect. + */ + public native @ByRef OpString writeImagesFormat(); public native WrapperStructOutput writeImagesFormat(OpString setter); + + /** + * Rendered images saving video path. + * Please, use *.avi format. + * If it is empty (default), it is disabled. + */ + public native @ByRef OpString writeVideo(); public native WrapperStructOutput writeVideo(OpString setter); + + /** + * Frame rate of the recorded video. + * By default (-1.), it will try to get the input frames producer frame rate (e.g., input video or webcam frame + * rate). If the input frames producer does not have a set FPS (e.g., image_dir or webcam if OpenCV not + * compiled with its support), set this value accordingly (e.g., to the frame rate displayed by the OpenPose + * GUI). + */ + public native double writeVideoFps(); public native WrapperStructOutput writeVideoFps(double setter); + + /** + * Whether to save the output video with audio. The input producer must be a video too. + */ + public native @Cast("bool") boolean writeVideoWithAudio(); public native WrapperStructOutput writeVideoWithAudio(boolean setter); + + /** + * Rendered heat maps saving folder. + * In order to save the heatmaps, WrapperStructPose.heatMapTypes must also be filled. + * If it is empty (default), it is disabled. + */ + public native @ByRef OpString writeHeatMaps(); public native WrapperStructOutput writeHeatMaps(OpString setter); + + /** + * Heat maps image saving format. + * Analogous to writeImagesFormat. + */ + public native @ByRef OpString writeHeatMapsFormat(); public native WrapperStructOutput writeHeatMapsFormat(OpString setter); + + /** + * Rendered 3D images saving video path. + * Please, use *.avi format. + * If it is empty (default), it is disabled. + */ + public native @ByRef OpString writeVideo3D(); public native WrapperStructOutput writeVideo3D(OpString setter); + + /** + * Rendered Adam images saving video path. + * Please, use *.avi format. + * If it is empty (default), it is disabled. + */ + public native @ByRef OpString writeVideoAdam(); public native WrapperStructOutput writeVideoAdam(OpString setter); + + /** + * Path to save a 3-D joint angle BVH file. + * Please, use *.bvh format. + * If it is empty (default), it is disabled. + */ + public native @ByRef OpString writeBvh(); public native WrapperStructOutput writeBvh(OpString setter); + + /** + * Target server IP address for UDP client-server communication. + */ + public native @ByRef OpString udpHost(); public native WrapperStructOutput udpHost(OpString setter); + + /** + * Target server IP port for UDP client-server communication. + */ + public native @ByRef OpString udpPort(); public native WrapperStructOutput udpPort(OpString setter); + + /** + * Constructor of the struct. + * It has the recommended and default values we recommend for each element of the struct. + * Since all the elements of the struct are public, they can also be manually filled. + */ + public WrapperStructOutput( + double verbose/*=-1*/, @Const @ByRef(nullValue = "op::String(\"\")") OpString writeKeypoint, + DataFormat writeKeypointFormat/*=op::DataFormat::Xml*/, @Const @ByRef(nullValue = "op::String(\"\")") OpString writeJson, + @Const @ByRef(nullValue = "op::String(\"\")") OpString writeCocoJson, int writeCocoJsonVariants/*=1*/, + int writeCocoJsonVariant/*=1*/, @Const @ByRef(nullValue = "op::String(\"\")") OpString writeImages, + @Const @ByRef(nullValue = "op::String(\"png\")") OpString writeImagesFormat, @Const @ByRef(nullValue = "op::String(\"\")") OpString writeVideo, + double writeVideoFps/*=-1.*/, @Cast("const bool") boolean writeVideoWithAudio/*=false*/, + @Const @ByRef(nullValue = "op::String(\"\")") OpString writeHeatMaps, @Const @ByRef(nullValue = "op::String(\"png\")") OpString writeHeatMapsFormat, + @Const @ByRef(nullValue = "op::String(\"\")") OpString writeVideo3D, @Const @ByRef(nullValue = "op::String(\"\")") OpString writeVideoAdam, + @Const @ByRef(nullValue = "op::String(\"\")") OpString writeBvh, @Const @ByRef(nullValue = "op::String(\"\")") OpString udpHost, + @Const @ByRef(nullValue = "op::String(\"8051\")") OpString udpPort) { super((Pointer)null); allocate(verbose, writeKeypoint, writeKeypointFormat, writeJson, writeCocoJson, writeCocoJsonVariants, writeCocoJsonVariant, writeImages, writeImagesFormat, writeVideo, writeVideoFps, writeVideoWithAudio, writeHeatMaps, writeHeatMapsFormat, writeVideo3D, writeVideoAdam, writeBvh, udpHost, udpPort); } + private native void allocate( + double verbose/*=-1*/, @Const @ByRef(nullValue = "op::String(\"\")") OpString writeKeypoint, + DataFormat writeKeypointFormat/*=op::DataFormat::Xml*/, @Const @ByRef(nullValue = "op::String(\"\")") OpString writeJson, + @Const @ByRef(nullValue = "op::String(\"\")") OpString writeCocoJson, int writeCocoJsonVariants/*=1*/, + int writeCocoJsonVariant/*=1*/, @Const @ByRef(nullValue = "op::String(\"\")") OpString writeImages, + @Const @ByRef(nullValue = "op::String(\"png\")") OpString writeImagesFormat, @Const @ByRef(nullValue = "op::String(\"\")") OpString writeVideo, + double writeVideoFps/*=-1.*/, @Cast("const bool") boolean writeVideoWithAudio/*=false*/, + @Const @ByRef(nullValue = "op::String(\"\")") OpString writeHeatMaps, @Const @ByRef(nullValue = "op::String(\"png\")") OpString writeHeatMapsFormat, + @Const @ByRef(nullValue = "op::String(\"\")") OpString writeVideo3D, @Const @ByRef(nullValue = "op::String(\"\")") OpString writeVideoAdam, + @Const @ByRef(nullValue = "op::String(\"\")") OpString writeBvh, @Const @ByRef(nullValue = "op::String(\"\")") OpString udpHost, + @Const @ByRef(nullValue = "op::String(\"8051\")") OpString udpPort); + public WrapperStructOutput() { super((Pointer)null); allocate(); } + private native void allocate(); + } diff --git a/openpose/src/gen/java/org/bytedeco/openpose/WrapperStructPose.java b/openpose/src/gen/java/org/bytedeco/openpose/WrapperStructPose.java new file mode 100644 index 00000000000..4763aab873a --- /dev/null +++ b/openpose/src/gen/java/org/bytedeco/openpose/WrapperStructPose.java @@ -0,0 +1,266 @@ +// Targeted by JavaCPP version 1.5.4-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.openpose; + +import org.bytedeco.javacpp.annotation.Index; +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import static org.bytedeco.openblas.global.openblas_nolapack.*; +import static org.bytedeco.openblas.global.openblas.*; +import org.bytedeco.opencv.opencv_core.*; +import static org.bytedeco.opencv.global.opencv_core.*; +import org.bytedeco.opencv.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgcodecs.*; +import org.bytedeco.opencv.opencv_videoio.*; +import static org.bytedeco.opencv.global.opencv_videoio.*; +import org.bytedeco.opencv.opencv_highgui.*; +import static org.bytedeco.opencv.global.opencv_highgui.*; +import org.bytedeco.hdf5.*; +import static org.bytedeco.hdf5.global.hdf5.*; +import org.bytedeco.caffe.*; +import static org.bytedeco.caffe.global.caffe.*; + +import static org.bytedeco.openpose.global.openpose.*; + + /** + * WrapperStructPose: Pose estimation and rendering configuration struct. + * WrapperStructPose allows the user to set up the pose estimation and rendering parameters that will be used for + * the OpenPose WrapperT template and Wrapper class. + */ + @Namespace("op") @NoOffset @Properties(inherit = org.bytedeco.openpose.presets.openpose.class) +public class WrapperStructPose extends Pointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public WrapperStructPose(Pointer p) { super(p); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public WrapperStructPose(long size) { super((Pointer)null); allocateArray(size); } + private native void allocateArray(long size); + @Override public WrapperStructPose position(long position) { + return (WrapperStructPose)super.position(position); + } + + /** + * Whether to extract body. + * It might be optionally disabled for very few cases (e.g., if only face keypoint detection is desired for + * speedup while reducing its accuracy). Otherwise, it must be always enabled. + */ + public native PoseMode poseMode(); public native WrapperStructPose poseMode(PoseMode setter); + + /** + * CCN (Conv Net) input size. + * The greater, the slower and more memory it will be needed, but it will potentially increase accuracy. + * Both width and height must be divisible by 16. + */ + public native @ByRef IntPoint netInputSize(); public native WrapperStructPose netInputSize(IntPoint setter); + + /** + * Output size of the final rendered image. + * It barely affects performance compared to netInputSize. + * The final Datum.poseKeypoints can be scaled with respect to outputSize if {@code keypointScaleMode} is set to + * ScaleMode::OutputResolution, even if the rendering is disabled. + */ + public native @ByRef IntPoint outputSize(); public native WrapperStructPose outputSize(IntPoint setter); + + /** + * Final scale of the Array Datum.poseKeypoints and the writen pose data. + * The final Datum.poseKeypoints can be scaled with respect to input size (ScaleMode::InputResolution), net + * output size (ScaleMode::NetOutputResolution), output rendering size (ScaleMode::OutputResolution), from 0 to + * 1 (ScaleMode::ZeroToOne(FixedAspect)), and -1 to 1 (ScaleMode::PlusMinusOne(FixedAspect)). + */ + public native ScaleMode keypointScaleMode(); public native WrapperStructPose keypointScaleMode(ScaleMode setter); + + /** + * Number of GPUs processing in parallel. + * The greater, the faster the algorithm will run, but potentially higher lag will appear (which only affects + * in real-time webcam scenarios). + */ + public native int gpuNumber(); public native WrapperStructPose gpuNumber(int setter); + + /** + * First GPU device. + * Such as the GPUs used will be the ones in the range: [gpuNumberStart, gpuNumberStart + gpuNumber]. + */ + public native int gpuNumberStart(); public native WrapperStructPose gpuNumberStart(int setter); + + /** + * Number of scales to process. + * The greater, the slower and more memory it will be needed, but it will potentially increase accuracy. + * This parameter is related with scaleGap, such as the final pose estimation will be an average of the + * predicted results for each scale. + */ + public native int scalesNumber(); public native WrapperStructPose scalesNumber(int setter); + + /** + * Gap between successive scales. + * The pose estimation will be estimation for the scales in the range [1, 1-scaleGap*scalesNumber], with a gap + * of scaleGap. + */ + public native float scaleGap(); public native WrapperStructPose scaleGap(float setter); + + /** + * Whether to render the output (pose locations, body, background or PAF heat maps) with CPU or GPU. + * Select {@code None} for no rendering, {@code Cpu} or {@code Gpu} por CPU and GPU rendering respectively. + */ + public native RenderMode renderMode(); public native WrapperStructPose renderMode(RenderMode setter); + + /** + * Pose model, it affects the number of body parts to render + * Select PoseModel::BODY_25 for 25 body-part COCO + foot model; PoseModel::COCO_18 for 18 body-part COCO; + * PoseModel::MPI_15 for 15 body-part MPI; PoseModel::MPI_15_4 for faster version of MPI; etc.. + */ + public native PoseModel poseModel(); public native WrapperStructPose poseModel(PoseModel setter); + + /** + * Whether to blend the final results on top of the original image, or just render them on a flat background. + */ + public native @Cast("bool") boolean blendOriginalFrame(); public native WrapperStructPose blendOriginalFrame(boolean setter); + + /** + * Rendering blending alpha value of the pose point locations with respect to the background image. + * Value in the range [0, 1]. 0 will only render the background, 1 will fully render the pose. + */ + public native float alphaKeypoint(); public native WrapperStructPose alphaKeypoint(float setter); + + /** + * Rendering blending alpha value of the heat maps (body part, background or PAF) with respect to the + * background image. + * Value in the range [0, 1]. 0 will only render the background, 1 will only render the heat map. + */ + public native float alphaHeatMap(); public native WrapperStructPose alphaHeatMap(float setter); + + /** + * Element to initially render. + * Set 0 for pose, [1, #body parts] for each body part following the order on POSE_BODY_PART_MAPPING on + * {@code include/pose/poseParameters.hpp}, #body parts+1 for background, #body parts+2 for all body parts + * overlapped, #body parts+3 for all PAFs, and [#body parts+4, #body parts+4+#pair pairs] for each PAF + * following the order on POSE_BODY_PART_PAIRS. + */ + public native int defaultPartToRender(); public native WrapperStructPose defaultPartToRender(int setter); + + /** + * Folder where the pose Caffe models are located. + */ + public native @ByRef OpString modelFolder(); public native WrapperStructPose modelFolder(OpString setter); + + /** + * Whether and which heat maps to save on the Array Datum.heatmaps. + * Use HeatMapType::Parts for body parts, HeatMapType::Background for the background, and HeatMapType::PAFs for + * the Part Affinity Fields. + */ + public native @ByRef HeatMapTypeVector heatMapTypes(); public native WrapperStructPose heatMapTypes(HeatMapTypeVector setter); + + /** + * Scale of the Datum.heatmaps. + * Select ScaleMode::ZeroToOne(FixedAspect) for range [0,1], ScaleMode::PlusMinusOne(FixedAspect) for [-1,1] + * and ScaleMode::UnsignedChar for [0, 255]. + * If heatMapTypes.empty(), then this parameters makes no effect. + */ + public native ScaleMode heatMapScaleMode(); public native WrapperStructPose heatMapScaleMode(ScaleMode setter); + + /** + * Whether to add the body part candidates. + * Candidates refer to all the detected body parts, before being assembled into people. + */ + public native @Cast("bool") boolean addPartCandidates(); public native WrapperStructPose addPartCandidates(boolean setter); + + /** + * Rendering threshold. Only estimated keypoints whose score confidences are higher than this value will be + * rendered. Note: Rendered refers only to visual display in the OpenPose basic GUI, not in the saved results. + * Generally, a high threshold (> 0.5) will only render very clear body parts; while small thresholds + * (~0.1) will also output guessed and occluded keypoints, but also more false positives (i.e., wrong + * detections). + */ + public native float renderThreshold(); public native WrapperStructPose renderThreshold(float setter); + + /** + * Maximum number of people to be detected. + * This parameter will limit the maximum number of people detected, by keeping the people with the + * {@code numberPeopleMax} top scores. + * Useful if you know the exact number of people in the scene, so it can remove false positives (if all the + * people have been detected. + * However, it might also include false negatives by removing very small or highly occluded people. + */ + public native int numberPeopleMax(); public native WrapperStructPose numberPeopleMax(int setter); + + /** + * Whether to maximize the number of positives. + * It reduces the thresholds to accept a person candidate. It highly increases both false and true positives. + * I.e., it maximizes average recall but could harm average precision. + */ + public native @Cast("bool") boolean maximizePositives(); public native WrapperStructPose maximizePositives(boolean setter); + + /** + * Maximum processing frame rate. + * By default (-1), OpenPose will process frames as fast as possible. + * Example usage: If OpenPose is displaying images too quickly, this can reduce the speed so the user can + * analyze better each frame from the GUI. + */ + public native double fpsMax(); public native WrapperStructPose fpsMax(double setter); + + /** + * Final path where the pose Caffe ProtoTxt file is located. + * The combination modelFolder + protoTxtPath represents the whole path to the prototxt file. + * If empty, it will use the default OpenPose ProtoTxt file. + */ + public native @ByRef OpString protoTxtPath(); public native WrapperStructPose protoTxtPath(OpString setter); + + /** + * Final path where the pose Caffe CaffeModel is located. + * The combination modelFolder + caffeModelPath represents the whole path to the caffemodel file. + * If empty, it will use the default OpenPose CaffeModel file. + */ + public native @ByRef OpString caffeModelPath(); public native WrapperStructPose caffeModelPath(OpString setter); + + /** + * The image upsampling scale. 8 is the stride of the network, so the ideal value to maximize the + * speed/accuracy trade-off. + */ + public native float upsamplingRatio(); public native WrapperStructPose upsamplingRatio(float setter); + + /** + * Whether to internally enable Google Logging. + * This option is only applicable if Caffe is used. + * Only disable it if the user is already calling google::InitGoogleLogging() in his code. + * If the user disables Google Logging and he does not call it by himself, then Caffe will start to pop up + * all the verbose messages. + */ + public native @Cast("bool") boolean enableGoogleLogging(); public native WrapperStructPose enableGoogleLogging(boolean setter); + + /** + * Constructor of the struct. + * It has the recommended and default values we recommend for each element of the struct. + * Since all the elements of the struct are public, they can also be manually filled. + */ + public WrapperStructPose( + PoseMode poseMode/*=op::PoseMode::Enabled*/, @Const @ByRef(nullValue = "op::Point{-1, 368}") IntPoint netInputSize, + @Const @ByRef(nullValue = "op::Point{-1, -1}") IntPoint outputSize, + ScaleMode keypointScaleMode/*=op::ScaleMode::InputResolution*/, int gpuNumber/*=-1*/, + int gpuNumberStart/*=0*/, int scalesNumber/*=1*/, float scaleGap/*=0.25f*/, + RenderMode renderMode/*=op::RenderMode::Auto*/, PoseModel poseModel/*=op::PoseModel::BODY_25*/, + @Cast("const bool") boolean blendOriginalFrame/*=true*/, float alphaKeypoint/*=POSE_DEFAULT_ALPHA_KEYPOINT*/, + float alphaHeatMap/*=POSE_DEFAULT_ALPHA_HEAT_MAP*/, int defaultPartToRender/*=0*/, + @Const @ByRef(nullValue = "op::String(\"models/\")") OpString modelFolder, @Const @ByRef(nullValue = "std::vector({})") HeatMapTypeVector heatMapTypes, + ScaleMode heatMapScaleMode/*=op::ScaleMode::UnsignedChar*/, @Cast("const bool") boolean addPartCandidates/*=false*/, + float renderThreshold/*=0.05f*/, int numberPeopleMax/*=-1*/, @Cast("const bool") boolean maximizePositives/*=false*/, + double fpsMax/*=-1.*/, @Const @ByRef(nullValue = "op::String(\"\")") OpString protoTxtPath, @Const @ByRef(nullValue = "op::String(\"\")") OpString caffeModelPath, + float upsamplingRatio/*=0.f*/, @Cast("const bool") boolean enableGoogleLogging/*=true*/) { super((Pointer)null); allocate(poseMode, netInputSize, outputSize, keypointScaleMode, gpuNumber, gpuNumberStart, scalesNumber, scaleGap, renderMode, poseModel, blendOriginalFrame, alphaKeypoint, alphaHeatMap, defaultPartToRender, modelFolder, heatMapTypes, heatMapScaleMode, addPartCandidates, renderThreshold, numberPeopleMax, maximizePositives, fpsMax, protoTxtPath, caffeModelPath, upsamplingRatio, enableGoogleLogging); } + private native void allocate( + PoseMode poseMode/*=op::PoseMode::Enabled*/, @Const @ByRef(nullValue = "op::Point{-1, 368}") IntPoint netInputSize, + @Const @ByRef(nullValue = "op::Point{-1, -1}") IntPoint outputSize, + ScaleMode keypointScaleMode/*=op::ScaleMode::InputResolution*/, int gpuNumber/*=-1*/, + int gpuNumberStart/*=0*/, int scalesNumber/*=1*/, float scaleGap/*=0.25f*/, + RenderMode renderMode/*=op::RenderMode::Auto*/, PoseModel poseModel/*=op::PoseModel::BODY_25*/, + @Cast("const bool") boolean blendOriginalFrame/*=true*/, float alphaKeypoint/*=POSE_DEFAULT_ALPHA_KEYPOINT*/, + float alphaHeatMap/*=POSE_DEFAULT_ALPHA_HEAT_MAP*/, int defaultPartToRender/*=0*/, + @Const @ByRef(nullValue = "op::String(\"models/\")") OpString modelFolder, @Const @ByRef(nullValue = "std::vector({})") HeatMapTypeVector heatMapTypes, + ScaleMode heatMapScaleMode/*=op::ScaleMode::UnsignedChar*/, @Cast("const bool") boolean addPartCandidates/*=false*/, + float renderThreshold/*=0.05f*/, int numberPeopleMax/*=-1*/, @Cast("const bool") boolean maximizePositives/*=false*/, + double fpsMax/*=-1.*/, @Const @ByRef(nullValue = "op::String(\"\")") OpString protoTxtPath, @Const @ByRef(nullValue = "op::String(\"\")") OpString caffeModelPath, + float upsamplingRatio/*=0.f*/, @Cast("const bool") boolean enableGoogleLogging/*=true*/); + public WrapperStructPose() { super((Pointer)null); allocate(); } + private native void allocate(); + } diff --git a/openpose/src/gen/java/org/bytedeco/openpose/global/openpose.java b/openpose/src/gen/java/org/bytedeco/openpose/global/openpose.java new file mode 100644 index 00000000000..12d34e2ccf8 --- /dev/null +++ b/openpose/src/gen/java/org/bytedeco/openpose/global/openpose.java @@ -0,0 +1,1064 @@ +// Targeted by JavaCPP version 1.5.4-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.openpose.global; + +import org.bytedeco.openpose.*; + +import org.bytedeco.javacpp.annotation.Index; +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import static org.bytedeco.openblas.global.openblas_nolapack.*; +import static org.bytedeco.openblas.global.openblas.*; +import org.bytedeco.opencv.opencv_core.*; +import static org.bytedeco.opencv.global.opencv_core.*; +import org.bytedeco.opencv.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgproc.*; +import static org.bytedeco.opencv.global.opencv_imgcodecs.*; +import org.bytedeco.opencv.opencv_videoio.*; +import static org.bytedeco.opencv.global.opencv_videoio.*; +import org.bytedeco.opencv.opencv_highgui.*; +import static org.bytedeco.opencv.global.opencv_highgui.*; +import org.bytedeco.hdf5.*; +import static org.bytedeco.hdf5.global.hdf5.*; +import org.bytedeco.caffe.*; +import static org.bytedeco.caffe.global.caffe.*; + +public class openpose extends org.bytedeco.openpose.presets.openpose { + static { Loader.load(); } + +// Targeting ../FloatArray2.java + + +// Targeting ../Float3.java + + +// Targeting ../FloatRectangle2.java + + +// Targeting ../HeatMapTypeVector.java + + +// Targeting ../Datums.java + + +// Targeting ../Float3Vector.java + + +// Targeting ../IntStringPair.java + + +// Targeting ../ProducerOpStringPair.java + + +// Parsed from openpose/utilities/enumClasses.hpp + +// #ifndef OPENPOSE_UTILITIES_ENUM_CLASSES_HPP +// #define OPENPOSE_UTILITIES_ENUM_CLASSES_HPP + @Namespace("op") public enum ErrorMode { + StdRuntimeError((byte)0), + FileLogging((byte)1), + StdCerr((byte)2), + All((byte)3); + + public final byte value; + private ErrorMode(byte v) { this.value = v; } + private ErrorMode(ErrorMode e) { this.value = e.value; } + public ErrorMode intern() { for (ErrorMode e : values()) if (e.value == value) return e; return this; } + @Override public String toString() { return intern().name(); } + } + + @Namespace("op") public enum LogMode { + FileLogging((byte)0), + StdCout((byte)1), + All((byte)2); + + public final byte value; + private LogMode(byte v) { this.value = v; } + private LogMode(LogMode e) { this.value = e.value; } + public LogMode intern() { for (LogMode e : values()) if (e.value == value) return e; return this; } + @Override public String toString() { return intern().name(); } + } + + @Namespace("op") public enum Priority { + None((byte)0), + Low((byte)1), + Normal((byte)2), + High((byte)3), + Max((byte)4), + NoOutput((byte)255); + + public final byte value; + private Priority(byte v) { this.value = v; } + private Priority(Priority e) { this.value = e.value; } + public Priority intern() { for (Priority e : values()) if (e.value == value) return e; return this; } + @Override public String toString() { return intern().name(); } + } + + @Namespace("op") public enum Extensions { + Images((byte)0), // jpg, png, ... + Size((byte)1); + + public final byte value; + private Extensions(byte v) { this.value = v; } + private Extensions(Extensions e) { this.value = e.value; } + public Extensions intern() { for (Extensions e : values()) if (e.value == value) return e; return this; } + @Override public String toString() { return intern().name(); } + } + + +// #endif // OPENPOSE_UTILITIES_ENUM_CLASSES_HPP + + +// Parsed from openpose/thread/enumClasses.hpp + +// #ifndef OPENPOSE_THREAD_ENUM_CLASSES_HPP +// #define OPENPOSE_THREAD_ENUM_CLASSES_HPP + /** + * ThreadManager synchronization mode. + */ + @Namespace("op") public enum ThreadManagerMode { + /** + * First and last queues of ThreadManager will be given to the user, so he must push elements to the first queue and retrieve + * them from the last one after being processed. + * Recommended for prototyping environments (easier to test but more error-prone and potentially slower in performance). + */ + Asynchronous((byte)0), + /** Similar to Asynchronous, but only the input (first) queue is given to the user. */ + AsynchronousIn((byte)1), + /** Similar to Asynchronous, but only the output (last) queue is given to the user. */ + AsynchronousOut((byte)2), + /** + * Everything will run inside the ThreadManager. + * Recommended for production environments (more difficult to set up but faster in performance and less error-prone). + */ + Synchronous((byte)3); + + public final byte value; + private ThreadManagerMode(byte v) { this.value = v; } + private ThreadManagerMode(ThreadManagerMode e) { this.value = e.value; } + public ThreadManagerMode intern() { for (ThreadManagerMode e : values()) if (e.value == value) return e; return this; } + @Override public String toString() { return intern().name(); } + } + + +// #endif // OPENPOSE_THREAD_ENUM_CLASSES_HPP + + +// Parsed from openpose/pose/enumClasses.hpp + +// #ifndef OPENPOSE_POSE_ENUM_CLASSES_HPP +// #define OPENPOSE_POSE_ENUM_CLASSES_HPP + /** + * An enum class in which all the possible type of pose estimation models are included. + */ + @Namespace("op") public enum PoseModel { + /** + * COCO + 6 foot keypoints + neck + lower abs model, with 25+1 components (see poseParameters.hpp for details). + */ + BODY_25((byte)0), + /** COCO model + neck, with 18+1 components (see poseParameters.hpp for details). */ + COCO_18((byte)1), + /** MPI model, with 15+1 components (see poseParameters.hpp for details). */ + MPI_15((byte)2), + /** Variation of the MPI model, reduced number of CNN stages to 4: faster but less accurate.*/ + MPI_15_4((byte)3), + /** Experimental. Do not use. */ + BODY_19((byte)4), + /** Experimental. Do not use. */ + BODY_19_X2((byte)5), + /** Experimental. Do not use. */ + BODY_19N((byte)6), + /** Experimental. Do not use. */ + BODY_25E((byte)7), + /** Experimental. Do not use. */ + CAR_12((byte)8), + /** Experimental. Do not use. */ + BODY_25D((byte)9), + /** Experimental. Do not use. */ + BODY_23((byte)10), + /** Experimental. Do not use. */ + CAR_22((byte)11), + /** Experimental. Do not use. */ + BODY_19E((byte)12), + /** Experimental. Do not use. */ + BODY_25B((byte)13), + /** Experimental. Do not use. */ + BODY_135((byte)14), + Size((byte)15); + + public final byte value; + private PoseModel(byte v) { this.value = v; } + private PoseModel(PoseModel e) { this.value = e.value; } + public PoseModel intern() { for (PoseModel e : values()) if (e.value == value) return e; return this; } + @Override public String toString() { return intern().name(); } + } + + @Namespace("op") public enum PoseProperty { + NMSThreshold((byte)0), + ConnectInterMinAboveThreshold((byte)1), + ConnectInterThreshold((byte)2), + ConnectMinSubsetCnt((byte)3), + ConnectMinSubsetScore((byte)4), + Size((byte)5); + + public final byte value; + private PoseProperty(byte v) { this.value = v; } + private PoseProperty(PoseProperty e) { this.value = e.value; } + public PoseProperty intern() { for (PoseProperty e : values()) if (e.value == value) return e; return this; } + @Override public String toString() { return intern().name(); } + } + + +// #endif // OPENPOSE_POSE_ENUM_CLASSES_HPP + + +// Parsed from openpose/core/enumClasses.hpp + +// #ifndef OPENPOSE_CORE_ENUM_CLASSES_HPP +// #define OPENPOSE_CORE_ENUM_CLASSES_HPP + @Namespace("op") public enum ScaleMode { + InputResolution((byte)0), + NetOutputResolution((byte)1), + OutputResolution((byte)2), + ZeroToOne((byte)3), // [0, 1] + ZeroToOneFixedAspect((byte)4), // [0, 1] + PlusMinusOne((byte)5), // [-1, 1] + PlusMinusOneFixedAspect((byte)6), // [-1, 1] + UnsignedChar((byte)7), // [0, 255] + NoScale((byte)8); + + public final byte value; + private ScaleMode(byte v) { this.value = v; } + private ScaleMode(ScaleMode e) { this.value = e.value; } + public ScaleMode intern() { for (ScaleMode e : values()) if (e.value == value) return e; return this; } + @Override public String toString() { return intern().name(); } + } + + @Namespace("op") public enum HeatMapType { + Parts((byte)0), + Background((byte)1), + PAFs((byte)2); + + public final byte value; + private HeatMapType(byte v) { this.value = v; } + private HeatMapType(HeatMapType e) { this.value = e.value; } + public HeatMapType intern() { for (HeatMapType e : values()) if (e.value == value) return e; return this; } + @Override public String toString() { return intern().name(); } + } + + @Namespace("op") public enum RenderMode { + None((byte)0), + Auto((byte)1), // It will select Gpu if CUDA verison, or Cpu otherwise + Cpu((byte)2), + Gpu((byte)3); + + public final byte value; + private RenderMode(byte v) { this.value = v; } + private RenderMode(RenderMode e) { this.value = e.value; } + public RenderMode intern() { for (RenderMode e : values()) if (e.value == value) return e; return this; } + @Override public String toString() { return intern().name(); } + } + + @Namespace("op") public enum ElementToRender { + Skeleton((byte)0), + Background((byte)1), + AddKeypoints((byte)2), + AddPAFs((byte)3); + + public final byte value; + private ElementToRender(byte v) { this.value = v; } + private ElementToRender(ElementToRender e) { this.value = e.value; } + public ElementToRender intern() { for (ElementToRender e : values()) if (e.value == value) return e; return this; } + @Override public String toString() { return intern().name(); } + } + + +// #endif // OPENPOSE_CORE_ENUM_CLASSES_HPP + + +// Parsed from openpose/gui/enumClasses.hpp + +// #ifndef OPENPOSE_GUI_ENUM_CLASSES_HPP +// #define OPENPOSE_GUI_ENUM_CLASSES_HPP + /** + * GUI display modes. + * An enum class with the different output screen options. E.g., 2-D, 3-D, all, none. + */ + @Namespace("op") public enum DisplayMode { + /** No display. */ + NoDisplay((short)0), + /** All (2-D and 3-D/Adam) displays */ + DisplayAll((short)1), + /** Only 2-D display. */ + Display2D((short)2), + /** Only 3-D display. */ + Display3D((short)3), + /** Only Adam display. */ + DisplayAdam((short)4); + + public final short value; + private DisplayMode(short v) { this.value = v; } + private DisplayMode(DisplayMode e) { this.value = e.value; } + public DisplayMode intern() { for (DisplayMode e : values()) if (e.value == value) return e; return this; } + @Override public String toString() { return intern().name(); } + } + + /** + * Full screen modes. + * An enum class with the different full screen mode options, i.e., full screen or windored. + */ + @Namespace("op") public enum FullScreenMode { + /** Full screen mode. */ + FullScreen(0 != 0), + /** Windowed mode, depending on the frame output size. */ + Windowed(1 != 0); + + public final boolean value; + private FullScreenMode(boolean v) { this.value = v; } + private FullScreenMode(FullScreenMode e) { this.value = e.value; } + public FullScreenMode intern() { for (FullScreenMode e : values()) if (e.value == value) return e; return this; } + @Override public String toString() { return intern().name(); } + } + + +// #endif // OPENPOSE_GUI_ENUM_CLASSES_HPP + + +// Parsed from openpose/producer/enumClasses.hpp + +// #ifndef OPENPOSE_PRODUCER_ENUM_CLASSES_HPP +// #define OPENPOSE_PRODUCER_ENUM_CLASSES_HPP + @Namespace("op") public enum ProducerFpsMode { + /** The frames will be extracted at the original source fps (frames might be skipped or repeated). */ + OriginalFps(0 != 0), + /** The frames will be extracted when the software retrieves them (frames will not be skipped or repeated). */ + RetrievalFps(1 != 0); + + public final boolean value; + private ProducerFpsMode(boolean v) { this.value = v; } + private ProducerFpsMode(ProducerFpsMode e) { this.value = e.value; } + public ProducerFpsMode intern() { for (ProducerFpsMode e : values()) if (e.value == value) return e; return this; } + @Override public String toString() { return intern().name(); } + } + + @Namespace("op") public enum ProducerProperty { + AutoRepeat((byte)0), + Flip((byte)1), + Rotation((byte)2), + FrameStep((byte)3), + NumberViews((byte)4), + Size((byte)5); + + public final byte value; + private ProducerProperty(byte v) { this.value = v; } + private ProducerProperty(ProducerProperty e) { this.value = e.value; } + public ProducerProperty intern() { for (ProducerProperty e : values()) if (e.value == value) return e; return this; } + @Override public String toString() { return intern().name(); } + } + + /** + * Type of producers + * An enum class in which all the possible type of Producer are included. In order to add a new Producer, + * include its name in this enum and add a new 'else if' statement inside ProducerFactory::createProducer(). + */ + @Namespace("op") public enum ProducerType { + /** Stereo FLIR (Point-Grey) camera reader. Based on Spinnaker SDK. */ + FlirCamera((byte)0), + /** An image directory reader. It is able to read images on a folder with a interface similar to the OpenCV + * cv::VideoCapture. + */ + ImageDirectory((byte)1), + /** An IP camera frames extractor, extending the functionality of cv::VideoCapture. */ + IPCamera((byte)2), + /** A video frames extractor, extending the functionality of cv::VideoCapture. */ + Video((byte)3), + /** A webcam frames extractor, extending the functionality of cv::VideoCapture. */ + Webcam((byte)4), + /** No type defined. Default state when no specific Producer has been picked yet. */ + None((byte)5); + + public final byte value; + private ProducerType(byte v) { this.value = v; } + private ProducerType(ProducerType e) { this.value = e.value; } + public ProducerType intern() { for (ProducerType e : values()) if (e.value == value) return e; return this; } + @Override public String toString() { return intern().name(); } + } + + +// #endif // OPENPOSE_PRODUCER_ENUM_CLASSES_HPP + + +// Parsed from openpose/filestream/enumClasses.hpp + +// #ifndef OPENPOSE_FILESTREAM_ENUM_CLASSES_HPP +// #define OPENPOSE_FILESTREAM_ENUM_CLASSES_HPP + @Namespace("op") public enum DataFormat { + Json((byte)0), + Xml((byte)1), + Yaml((byte)2), + Yml((byte)3); + + public final byte value; + private DataFormat(byte v) { this.value = v; } + private DataFormat(DataFormat e) { this.value = e.value; } + public DataFormat intern() { for (DataFormat e : values()) if (e.value == value) return e; return this; } + @Override public String toString() { return intern().name(); } + } + + @Namespace("op") public enum CocoJsonFormat { + Body((byte)0), + Hand21((byte)1), + Hand42((byte)2), + Face((byte)3), + Foot((byte)4), + Car((byte)5), + Size((byte)6); + + public final byte value; + private CocoJsonFormat(byte v) { this.value = v; } + private CocoJsonFormat(CocoJsonFormat e) { this.value = e.value; } + public CocoJsonFormat intern() { for (CocoJsonFormat e : values()) if (e.value == value) return e; return this; } + @Override public String toString() { return intern().name(); } + } + + +// #endif // OPENPOSE_FILESTREAM_ENUM_CLASSES_HPP + + +// Parsed from openpose/wrapper/enumClasses.hpp + +// #ifndef OPENPOSE_WRAPPER_ENUM_CLASSES_HPP +// #define OPENPOSE_WRAPPER_ENUM_CLASSES_HPP + @Namespace("op") public enum PoseMode { + Disabled((byte)0), + Enabled((byte)1), + NoNetwork((byte)2), + Size((byte)3); + + public final byte value; + private PoseMode(byte v) { this.value = v; } + private PoseMode(PoseMode e) { this.value = e.value; } + public PoseMode intern() { for (PoseMode e : values()) if (e.value == value) return e; return this; } + @Override public String toString() { return intern().name(); } + } + + @Namespace("op") public enum Detector { + Body((byte)0), + OpenCV((byte)1), + Provided((byte)2), + BodyWithTracking((byte)3), + Size((byte)4); + + public final byte value; + private Detector(byte v) { this.value = v; } + private Detector(Detector e) { this.value = e.value; } + public Detector intern() { for (Detector e : values()) if (e.value == value) return e; return this; } + @Override public String toString() { return intern().name(); } + } + + @Namespace("op") public enum WorkerType { + Input((byte)0), + PreProcessing((byte)1), + PostProcessing((byte)2), + Output((byte)3), + Size((byte)4); + + public final byte value; + private WorkerType(byte v) { this.value = v; } + private WorkerType(WorkerType e) { this.value = e.value; } + public WorkerType intern() { for (WorkerType e : values()) if (e.value == value) return e; return this; } + @Override public String toString() { return intern().name(); } + } + + +// #endif // OPENPOSE_WRAPPER_ENUM_CLASSES_HPP + + +// Parsed from openpose/core/matrix.hpp + +// #ifndef OPENPOSE_CORE_MAT_HPP +// #define OPENPOSE_CORE_MAT_HPP + +// #include // std::shared_ptr +// #include + // Convert from Matrix into cv::Mat. Usage example: + // #include + // ... + // cv::Mat opMat = OP2CVMAT(cv::Mat()); + public static native @ByVal Mat OP_OP2CVMAT(@ByVal Matrix opMat); + + // Convert from Matrix into const cv::Mat. Usage example: + // #include + // ... + // cv::Mat opMat = OP2CVCONSTMAT(cv::Mat()); + public static native @Const @ByVal Mat OP_OP2CVCONSTMAT(@ByVal Matrix opMat); + + // Convert from cv::Mat into Matrix. Usage example: + // #include + // ... + // Matrix opMat = CV2OPMAT(Matrix()); + public static native @ByVal Matrix OP_CV2OPMAT(@ByVal Mat cvMat); + + // Convert from cv::Mat into const Matrix. Usage example: + // #include + // ... + // Matrix opMat = CV2OPCONSTMAT(Matrix()); + public static native @Const @ByVal Matrix OP_CV2OPCONSTMAT(@ByVal Mat cvMat); + + // Convert from std::vector into std::vector. Usage example: + // #include + // ... + // std::vector opMats; // Assume filled + // OP_OP2CVVECTORMAT(cvMats, opMats); +// #define OP_OP2CVVECTORMAT(cvMats, opMats) +// std::vector cvMats; +// for (auto& opMat : (opMats)) +// { +// const auto cvMat = OP_OP2CVCONSTMAT(opMat); +// cvMats.emplace_back(cvMat); +// } + + // Convert from std::vector into std::vector. Usage example: + // #include + // ... + // std::vector cvMats; // Assume filled + // OP_CV2OPVECTORMAT(opMats, cvMats); +// #define OP_CV2OPVECTORMAT(opMats, cvMats) +// std::vector opMats; +// for (auto& cvMat : (cvMats)) +// { +// const auto opMat = OP_CV2OPMAT(cvMat); +// opMats.emplace_back(opMat); +// } + + // Convert from std::vector into std::vector. Usage example: + // #include + // ... + // // Equivalents: + // OP_CV_VOID_FUNCTION(opMat, size()); + // // and + // OP_OP2CVMAT(cvMat, opMat); + // cvMat.size(); +// #define OP_MAT_VOID_FUNCTION(opMat, function) +// { +// cv::Mat cvMat = OP_OP2CVMAT(cvMat, opMat); +// cvMat.fnction; +// } +// #define OP_CONST_MAT_VOID_FUNCTION(opMat, function) +// { +// const cv::Mat cvMat = OP_OP2CVCONSTMAT(opMat); +// cvMat.fnction; +// } +// #define OP_MAT_RETURN_FUNCTION(outputVariable, opMat, function) +// { +// cv::Mat cvMat = OP_OP2CVMAT(cvMat, opMat); +// outputVariable = cvMat.fnction; +// } +// #define OP_CONST_MAT_RETURN_FUNCTION(outputVariable, opMat, function) +// { +// const cv::Mat cvMat = OP_OP2CVCONSTMAT(opMat); +// outputVariable = cvMat.fnction; +// } +// Targeting ../Matrix.java + + + + +// #endif // OPENPOSE_CORE_MAT_HPP + + +// Parsed from openpose/core/array.hpp + +// #ifndef OPENPOSE_CORE_ARRAY_HPP +// #define OPENPOSE_CORE_ARRAY_HPP + +// #include // std::shared_ptr +// #include +// #include +// #include +// #include +// Targeting ../FloatArray.java + + +// Targeting ../LongLongArray.java + + + + // Static methods + + +// #endif // OPENPOSE_CORE_ARRAY_HPP + + +// Parsed from openpose/core/point.hpp + +// #ifndef OPENPOSE_CORE_POINT_HPP +// #define OPENPOSE_CORE_POINT_HPP + +// #include +// #include +// Targeting ../IntPoint.java + + +// Targeting ../FloatPoint.java + + + + // Static methods + + +// #endif // OPENPOSE_CORE_POINT_HPP + + +// Parsed from openpose/core/rectangle.hpp + +// #ifndef OPENPOSE_CORE_RECTANGLE_HPP +// #define OPENPOSE_CORE_RECTANGLE_HPP + +// #include +// #include +// #include +// Targeting ../FloatRectangle.java + + + + // Static methods + + + +// #endif // OPENPOSE_CORE_RECTANGLE_HPP + + +// Parsed from openpose/core/string.hpp + +// #ifndef OPENPOSE_CORE_STRING_HPP +// #define OPENPOSE_CORE_STRING_HPP + +// #include // std::shared_ptr +// #include +// #include +// Targeting ../OpString.java + + + + +// #endif // OPENPOSE_CORE_STRING_HPP + + +// Parsed from openpose/core/datum.hpp + +// #ifndef OPENPOSE_CORE_DATUM_HPP +// #define OPENPOSE_CORE_DATUM_HPP + +// #ifdef USE_3D_ADAM_MODEL +// #endif +// #include +// Targeting ../Datum.java + + + + // Defines for Datum. Added here rather than in `macros.hpp` to avoid circular dependencies +// #define BASE_DATUM Datum +// #define BASE_DATUMS std::vector> +// #define BASE_DATUMS_SH std::shared_ptr +// #define DEFINE_TEMPLATE_DATUM(templateName) template class OP_API templateName +// #define COMPILE_TEMPLATE_DATUM(templateName) extern template class templateName + + +// #endif // OPENPOSE_CORE_DATUM_HPP + + +// Parsed from openpose/thread/worker.hpp + +// #ifndef OPENPOSE_THREAD_WORKER_HPP +// #define OPENPOSE_THREAD_WORKER_HPP + +// #include +// Targeting ../DatumsWorker.java + + + + + + + + +// Implementation + + + + + + + + + +// #endif // OPENPOSE_THREAD_WORKER_HPP + + +// Parsed from openpose/utilities/flagsToOpenPose.hpp + +// #ifndef OPENPOSE_UTILITIES_FLAGS_TO_OPEN_POSE_HPP +// #define OPENPOSE_UTILITIES_FLAGS_TO_OPEN_POSE_HPP + +// #include +// #include +// #include +// #include +// #include +// #include + @Namespace("op") public static native PoseMode flagsToPoseMode(int poseModeInt); + + @Namespace("op") public static native PoseModel flagsToPoseModel(@Const @ByRef OpString poseModeString); + + @Namespace("op") public static native ScaleMode flagsToScaleMode(int keypointScaleMode); + + @Namespace("op") public static native ScaleMode flagsToHeatMapScaleMode(int heatMapScaleMode); + + @Namespace("op") public static native Detector flagsToDetector(int detector); + + // Determine type of frame source + @Namespace("op") public static native ProducerType flagsToProducerType( + @Const @ByRef OpString imageDirectory, @Const @ByRef OpString videoPath, @Const @ByRef OpString ipCameraPath, + int webcamIndex, @Cast("const bool") boolean flirCamera); + + @Namespace("op") public static native @ByVal ProducerOpStringPair flagsToProducer( + @Const @ByRef OpString imageDirectory, @Const @ByRef OpString videoPath, @Const @ByRef(nullValue = "op::String(\"\")") OpString ipCameraPath, + int webcamIndex/*=-1*/, @Cast("const bool") boolean flirCamera/*=false*/, int flirCameraIndex/*=-1*/); + @Namespace("op") public static native @ByVal ProducerOpStringPair flagsToProducer( + @Const @ByRef OpString imageDirectory, @Const @ByRef OpString videoPath); + + @Namespace("op") public static native @ByVal HeatMapTypeVector flagsToHeatMaps( + @Cast("const bool") boolean heatMapsAddParts/*=false*/, @Cast("const bool") boolean heatMapsAddBkg/*=false*/, + @Cast("const bool") boolean heatMapsAddPAFs/*=false*/); + @Namespace("op") public static native @ByVal HeatMapTypeVector flagsToHeatMaps(); + + @Namespace("op") public static native RenderMode flagsToRenderMode( + int renderFlag, @Cast("const bool") boolean gpuBuggy/*=false*/, int renderPoseFlag/*=-2*/); + @Namespace("op") public static native RenderMode flagsToRenderMode( + int renderFlag); + + @Namespace("op") public static native DisplayMode flagsToDisplayMode(int display, @Cast("const bool") boolean enabled3d); + + @Namespace("op") public static native @ByVal IntPoint flagsToPoint(@Const @ByRef OpString pointString, @Const @ByRef(nullValue = "op::String(\"1280x720\")") OpString pointExample); + @Namespace("op") public static native @ByVal IntPoint flagsToPoint(@Const @ByRef OpString pointString); + + +// #endif // OPENPOSE_UTILITIES_FLAGS_TO_OPEN_POSE_HPP + + +// Parsed from openpose/wrapper/wrapperStructExtra.hpp + +// #ifndef OPENPOSE_WRAPPER_WRAPPER_STRUCT_EXTRA_HPP +// #define OPENPOSE_WRAPPER_WRAPPER_STRUCT_EXTRA_HPP + +// #include +// Targeting ../WrapperStructExtra.java + + + + +// #endif // OPENPOSE_WRAPPER_WRAPPER_STRUCT_EXTRA_HPP + + +// Parsed from openpose/wrapper/wrapperStructFace.hpp + +// #ifndef OPENPOSE_WRAPPER_WRAPPER_STRUCT_FACE_HPP +// #define OPENPOSE_WRAPPER_WRAPPER_STRUCT_FACE_HPP + +// #include +// #include +// #include +// #include +// Targeting ../WrapperStructFace.java + + + + +// #endif // OPENPOSE_WRAPPER_WRAPPER_STRUCT_FACE_HPP + + +// Parsed from openpose/wrapper/wrapperStructGui.hpp + +// #ifndef OPENPOSE_WRAPPER_WRAPPER_STRUCT_GUI_HPP +// #define OPENPOSE_WRAPPER_WRAPPER_STRUCT_GUI_HPP + +// #include +// #include +// Targeting ../WrapperStructGui.java + + + + +// #endif // OPENPOSE_WRAPPER_WRAPPER_STRUCT_GUI_HPP + + +// Parsed from openpose/wrapper/wrapperStructHand.hpp + +// #ifndef OPENPOSE_WRAPPER_WRAPPER_STRUCT_HAND_HPP +// #define OPENPOSE_WRAPPER_WRAPPER_STRUCT_HAND_HPP + +// #include +// #include +// #include +// #include +// Targeting ../WrapperStructHand.java + + + + +// #endif // OPENPOSE_WRAPPER_WRAPPER_STRUCT_HAND_HPP + + +// Parsed from openpose/wrapper/wrapperStructInput.hpp + +// #ifndef OPENPOSE_WRAPPER_WRAPPER_STRUCT_INPUT_HPP +// #define OPENPOSE_WRAPPER_WRAPPER_STRUCT_INPUT_HPP + +// #include // std::numeric_limits +// #include +// #include +// Targeting ../WrapperStructInput.java + + + + +// #endif // OPENPOSE_WRAPPER_WRAPPER_STRUCT_INPUT_HPP + + +// Parsed from openpose/wrapper/wrapperStructOutput.hpp + +// #ifndef OPENPOSE_WRAPPER_WRAPPER_STRUCT_OUTPUT_HPP +// #define OPENPOSE_WRAPPER_WRAPPER_STRUCT_OUTPUT_HPP + +// #include +// #include +// #include +// Targeting ../WrapperStructOutput.java + + + + +// #endif // OPENPOSE_WRAPPER_WRAPPER_STRUCT_OUTPUT_HPP + + +// Parsed from openpose/wrapper/wrapperStructPose.hpp + +// #ifndef OPENPOSE_WRAPPER_WRAPPER_STRUCT_POSE_HPP +// #define OPENPOSE_WRAPPER_WRAPPER_STRUCT_POSE_HPP + +// #include +// #include +// #include +// #include +// #include +// #include +// Targeting ../WrapperStructPose.java + + + + +// #endif // OPENPOSE_WRAPPER_WRAPPER_STRUCT_POSE_HPP + + +// Parsed from openpose/producer/producer.hpp + +// #ifndef OPENPOSE_PRODUCER_PRODUCER_HPP +// #define OPENPOSE_PRODUCER_PRODUCER_HPP + +// #include +// #include +// #include +// Targeting ../Producer.java + + + + /** + * This function returns the desired producer given the input parameters. + */ + @Namespace("op") public static native @SharedPtr Producer createProducer( + ProducerType producerType/*=op::ProducerType::None*/, @StdString BytePointer producerString/*=""*/, + @Const @ByRef(nullValue = "op::Point{-1,-1}") IntPoint cameraResolution, + @StdString BytePointer cameraParameterPath/*="models/cameraParameters/"*/, @Cast("const bool") boolean undistortImage/*=true*/, + int numberViews/*=-1*/); + @Namespace("op") public static native @SharedPtr Producer createProducer(); + @Namespace("op") public static native @SharedPtr Producer createProducer( + ProducerType producerType/*=op::ProducerType::None*/, @StdString String producerString/*=""*/, + @Const @ByRef(nullValue = "op::Point{-1,-1}") IntPoint cameraResolution, + @StdString String cameraParameterPath/*="models/cameraParameters/"*/, @Cast("const bool") boolean undistortImage/*=true*/, + int numberViews/*=-1*/); + + +// #endif // OPENPOSE_PRODUCER_PRODUCER_HPP + + +// Parsed from openpose/wrapper/wrapperAuxiliary.hpp + +// #ifndef OPENPOSE_WRAPPER_WRAPPER_AUXILIARY_HPP +// #define OPENPOSE_WRAPPER_WRAPPER_AUXILIARY_HPP + +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include + /** + * It checks that no wrong/contradictory flags are enabled for Wrapper(T) + * @param wrapperStructPose + * @param wrapperStructFace + * @param wrapperStructHand + * @param wrapperStructExtra + * @param wrapperStructInput + * @param wrapperStructOutput + * @param renderOutput + * @param userOutputWsEmpty + * @param producerSharedPtr + * @param threadManagerMode + */ + @Namespace("op") public static native void wrapperConfigureSanityChecks( + @ByRef WrapperStructPose wrapperStructPose, @Const @ByRef WrapperStructFace wrapperStructFace, + @Const @ByRef WrapperStructHand wrapperStructHand, @Const @ByRef WrapperStructExtra wrapperStructExtra, + @Const @ByRef WrapperStructInput wrapperStructInput, @Const @ByRef WrapperStructOutput wrapperStructOutput, + @Const @ByRef WrapperStructGui wrapperStructGui, @Cast("const bool") boolean renderOutput, @Cast("const bool") boolean userInputAndPreprocessingWsEmpty, + @Cast("const bool") boolean userOutputWsEmpty, @SharedPtr Producer producerSharedPtr, + ThreadManagerMode threadManagerMode); + + /** + * Thread ID increase (private internal function). + * If multi-threading mode, it increases the thread ID. + * If single-threading mode (for debugging), it does not modify it. + * Note that mThreadId must be re-initialized to 0 before starting a new Wrapper(T) configuration. + * @param threadId unsigned long long element with the current thread id value. I will be edited to the next + * {@code desired thread id number. + */ + @Namespace("op") public static native void threadIdPP(@Cast("unsigned long long*") @ByRef LongPointer threadId, @Cast("const bool") boolean multiThreadEnabled); + @Namespace("op") public static native void threadIdPP(@Cast("unsigned long long*") @ByRef LongBuffer threadId, @Cast("const bool") boolean multiThreadEnabled); + @Namespace("op") public static native void threadIdPP(@Cast("unsigned long long*") @ByRef long[] threadId, @Cast("const bool") boolean multiThreadEnabled); + + /** + * Set ThreadManager from TWorkers (private internal function). + * After any configure() has been called, the TWorkers are initialized. This function resets the ThreadManager + * and adds them. + * Common code for start() and exec(). + */ + + /** + * It fills camera parameters and splits the cvMat depending on how many camera parameter matrices are found. + * For example usage, check {@code examples/tutorial_api_cpp/11_asynchronous_custom_input_multi_camera.cpp} + */ + + + + + + +// Implementation +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include + + +// #endif // OPENPOSE_WRAPPER_WRAPPER_AUXILIARY_HPP + + +// Parsed from openpose/wrapper/wrapper.hpp + +// #ifndef OPENPOSE_WRAPPER_WRAPPER_HPP +// #define OPENPOSE_WRAPPER_WRAPPER_HPP + +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// Targeting ../OpWrapper.java + + + + // Type + + + + + + +// Implementation +// #include + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +// #endif // OPENPOSE_WRAPPER_WRAPPER_HPP + + +} diff --git a/openpose/src/main/java/org/bytedeco/openpose/helper/openpose.java b/openpose/src/main/java/org/bytedeco/openpose/helper/openpose.java deleted file mode 100644 index e35e61f8193..00000000000 --- a/openpose/src/main/java/org/bytedeco/openpose/helper/openpose.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.bytedeco.openpose.helper; - -public class openpose extends org.bytedeco.openpose.presets.openpose { - public static int POSE_MAX_PEOPLE = 127; - public static float POSE_DEFAULT_ALPHA_KEYPOINT = 0.6f; - public static float POSE_DEFAULT_ALPHA_HEAT_MAP = 0.7f; - public static int FACE_MAX_FACES = 127; - public static float FACE_DEFAULT_ALPHA_KEYPOINT = 0.6f; - public static float FACE_DEFAULT_ALPHA_HEAT_MAP = 0.7f; - public static int HAND_MAX_HANDS = 254; - public static int HAND_NUMBER_PARTS = 21; - public static float HAND_CCN_DECREASE_FACTOR = 8.0f; - public static float HAND_DEFAULT_ALPHA_KEYPOINT = 0.6f; - public static float HAND_DEFAULT_ALPHA_HEAT_MAP = 0.7f; -} diff --git a/openpose/src/main/java/org/bytedeco/openpose/presets/openpose.java b/openpose/src/main/java/org/bytedeco/openpose/presets/openpose.java index 09f4e27ad9c..7c2b3a8d58e 100644 --- a/openpose/src/main/java/org/bytedeco/openpose/presets/openpose.java +++ b/openpose/src/main/java/org/bytedeco/openpose/presets/openpose.java @@ -1,3 +1,25 @@ +/* + * Copyright (C) 2020 Frankie Robertson + * + * Licensed either under the Apache License, Version 2.0, or (at your option) + * under the terms of the GNU General Public License as published by + * the Free Software Foundation (subject to the "Classpath" exception), + * either version 2, or any later version (collectively, the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.gnu.org/licenses/ + * http://www.gnu.org/software/classpath/license.html + * + * or as provided in the LICENSE.txt file that accompanied this code. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.bytedeco.openpose.presets; import java.util.List; @@ -20,7 +42,7 @@ @Properties( - inherit = {opencv_core.class, opencv_highgui.class, opencv_imgproc.class, opencv_imgcodecs.class, openblas.class, caffe.class, hdf5.class}, + inherit = caffe.class, value = { @Platform( value = {"linux", "macosx"}, @@ -65,35 +87,34 @@ }, link = { "openpose@.1.6.0", - "openpose_3d@.1.6.0", - "openpose_calibration@.1.6.0", - "openpose_core@.1.6.0", - "openpose_face@.1.6.0", - "openpose_filestream@.1.6.0", - "openpose_gpu@.1.6.0", - "openpose_gui@.1.6.0", - "openpose_hand@.1.6.0", - "openpose_net@.1.6.0", - "openpose_pose@.1.6.0", - "openpose_producer@.1.6.0", - "openpose_thread@.1.6.0", - "openpose_tracking@.1.6.0", - "openpose_unity@.1.6.0", - "openpose_utilities@.1.6.0", - "openpose_wrapper@.1.6.0", + "openpose_3d", + "openpose_calibration", + "openpose_core", + "openpose_face", + "openpose_filestream", + "openpose_gpu", + "openpose_gui", + "openpose_hand", + "openpose_net", + "openpose_pose", + "openpose_producer", + "openpose_thread", + "openpose_tracking", + "openpose_unity", + "openpose_utilities", + "openpose_wrapper", }, - includepath = {"/usr/local/cuda/include/"}, + includepath = "/usr/local/cuda/include/", linkpath = "/usr/local/cuda/lib/" ), @Platform( - value = {"linux-x86_64"}, - define = {"GPU_MODE CUDA"}, + value = "linux-x86_64", + define = "GPU_MODE CUDA", extension = "-gpu" ) }, target = "org.bytedeco.openpose", - global = "org.bytedeco.openpose.global.openpose", - helper = "org.bytedeco.openpose.helper.openpose" + global = "org.bytedeco.openpose.global.openpose" ) public class openpose implements InfoMapper { public void map(InfoMap infoMap) { @@ -179,4 +200,16 @@ public void map(InfoMap infoMap) { // don't need this .put(new Info("OVERLOAD_C_OUT").cppText("#define OVERLOAD_C_OUT(x)")); } + + public static int POSE_MAX_PEOPLE = 127; + public static float POSE_DEFAULT_ALPHA_KEYPOINT = 0.6f; + public static float POSE_DEFAULT_ALPHA_HEAT_MAP = 0.7f; + public static int FACE_MAX_FACES = 127; + public static float FACE_DEFAULT_ALPHA_KEYPOINT = 0.6f; + public static float FACE_DEFAULT_ALPHA_HEAT_MAP = 0.7f; + public static int HAND_MAX_HANDS = 254; + public static int HAND_NUMBER_PARTS = 21; + public static float HAND_CCN_DECREASE_FACTOR = 8.0f; + public static float HAND_DEFAULT_ALPHA_KEYPOINT = 0.6f; + public static float HAND_DEFAULT_ALPHA_HEAT_MAP = 0.7f; } diff --git a/platform/pom.xml b/platform/pom.xml index 6f23c62e180..37d002386a7 100644 --- a/platform/pom.xml +++ b/platform/pom.xml @@ -48,6 +48,7 @@ ../leptonica/platform ../tesseract/platform ../caffe/platform + ../openpose/platform ../cuda/platform ../mxnet/platform ../tensorflow/platform @@ -235,6 +236,11 @@ caffe-platform 1.0-${project.version} + + org.bytedeco + openpose-platform + 1.6.0-${project.version} + org.bytedeco cuda-platform diff --git a/pom.xml b/pom.xml index 0548796efe9..7858db76881 100644 --- a/pom.xml +++ b/pom.xml @@ -1404,6 +1404,7 @@ leptonica tesseract caffe + openpose cuda mxnet tensorflow From 2e18a7c440815026bc2b60ff29a3e9a2ffd2aff6 Mon Sep 17 00:00:00 2001 From: Samuel Audet Date: Thu, 25 Jun 2020 19:36:09 +0900 Subject: [PATCH 3/3] Fix Boost install for Linux on Travis CI --- ci/install-travis.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/install-travis.sh b/ci/install-travis.sh index a9540fbaa19..296f6725e69 100755 --- a/ci/install-travis.sh +++ b/ci/install-travis.sh @@ -63,7 +63,7 @@ if [[ "$OS" == "linux-x86" ]] || [[ "$OS" == "linux-x86_64" ]] || [[ "$OS" =~ an echo "Container id is $DOCKER_CONTAINER_ID please wait while updates applied" docker exec -ti $DOCKER_CONTAINER_ID /bin/bash -xec "yum -q -y install centos-release-scl-rh epel-release" docker exec -ti $DOCKER_CONTAINER_ID /bin/bash -xec "yum -y repolist" - docker exec -ti $DOCKER_CONTAINER_ID /bin/bash -xec "yum -q -y install rh-java-common-ant $SCL_ENABLE boost ccache clang gcc-c++ gcc-gfortran java-1.8.0-openjdk-devel ant python python36-devel python36-pip swig file which wget unzip tar bzip2 gzip xz patch make autoconf-archive libtool bison flex perl nasm yasm alsa-lib-devel freeglut-devel gtk2-devel libusb-devel libusb1-devel curl-devel expat-devel gettext-devel openssl-devel zlib-devel SDL-devel libva-devel libxkbcommon-devel libxkbcommon-x11-devel xcb-util* fontconfig-devel libffi-devel ragel" + docker exec -ti $DOCKER_CONTAINER_ID /bin/bash -xec "yum -q -y install rh-java-common-ant $SCL_ENABLE boost-devel ccache clang gcc-c++ gcc-gfortran java-1.8.0-openjdk-devel ant python python36-devel python36-pip swig file which wget unzip tar bzip2 gzip xz patch make autoconf-archive libtool bison flex perl nasm yasm alsa-lib-devel freeglut-devel gtk2-devel libusb-devel libusb1-devel curl-devel expat-devel gettext-devel openssl-devel zlib-devel SDL-devel libva-devel libxkbcommon-devel libxkbcommon-x11-devel xcb-util* fontconfig-devel libffi-devel ragel" docker exec -ti $DOCKER_CONTAINER_ID /bin/bash -xec "yum -y update" if [ "$OS" == "linux-x86" ]; then docker exec -ti $DOCKER_CONTAINER_ID /bin/bash -xec "rpm -qa | sed s/.x86_64$/.i686/ | xargs yum -q -y install"