001//
002// This file is auto-generated. Please don't modify it!
003//
004package org.opencv.dnn;
005
006import java.util.ArrayList;
007import java.util.List;
008import org.opencv.core.Mat;
009import org.opencv.core.MatOfPoint2f;
010import org.opencv.dnn.Model;
011import org.opencv.dnn.Net;
012import org.opencv.utils.Converters;
013
014// C++: class KeypointsModel
015/**
016 * This class represents high-level API for keypoints models
017 *
018 * KeypointsModel allows to set params for preprocessing input image.
019 * KeypointsModel creates net from file with trained weights and config,
020 * sets preprocessing input, runs forward pass and returns the x and y coordinates of each detected keypoint
021 */
022public class KeypointsModel extends Model {
023
024    protected KeypointsModel(long addr) { super(addr); }
025
026    // internal usage only
027    public static KeypointsModel __fromPtr__(long addr) { return new KeypointsModel(addr); }
028
029    //
030    // C++:   cv::dnn::KeypointsModel::KeypointsModel(String model, String config = "")
031    //
032
033    /**
034     * Create keypoints model from network represented in one of the supported formats.
035     * An order of {@code model} and {@code config} arguments does not matter.
036     * @param model Binary file contains trained weights.
037     * @param config Text file contains network configuration.
038     */
039    public KeypointsModel(String model, String config) {
040        super(KeypointsModel_0(model, config));
041    }
042
043    /**
044     * Create keypoints model from network represented in one of the supported formats.
045     * An order of {@code model} and {@code config} arguments does not matter.
046     * @param model Binary file contains trained weights.
047     */
048    public KeypointsModel(String model) {
049        super(KeypointsModel_1(model));
050    }
051
052
053    //
054    // C++:   cv::dnn::KeypointsModel::KeypointsModel(Net network)
055    //
056
057    /**
058     * Create model from deep learning network.
059     * @param network Net object.
060     */
061    public KeypointsModel(Net network) {
062        super(KeypointsModel_2(network.nativeObj));
063    }
064
065
066    //
067    // C++:  vector_Point2f cv::dnn::KeypointsModel::estimate(Mat frame, float thresh = 0.5)
068    //
069
070    /**
071     * Given the {@code input} frame, create input blob, run net
072     * @param thresh minimum confidence threshold to select a keypoint
073     * @return a vector holding the x and y coordinates of each detected keypoint
074     *
075     * @param frame automatically generated
076     */
077    public MatOfPoint2f estimate(Mat frame, float thresh) {
078        return MatOfPoint2f.fromNativeAddr(estimate_0(nativeObj, frame.nativeObj, thresh));
079    }
080
081    /**
082     * Given the {@code input} frame, create input blob, run net
083     * @return a vector holding the x and y coordinates of each detected keypoint
084     *
085     * @param frame automatically generated
086     */
087    public MatOfPoint2f estimate(Mat frame) {
088        return MatOfPoint2f.fromNativeAddr(estimate_1(nativeObj, frame.nativeObj));
089    }
090
091
092    @Override
093    protected void finalize() throws Throwable {
094        delete(nativeObj);
095    }
096
097
098
099    // C++:   cv::dnn::KeypointsModel::KeypointsModel(String model, String config = "")
100    private static native long KeypointsModel_0(String model, String config);
101    private static native long KeypointsModel_1(String model);
102
103    // C++:   cv::dnn::KeypointsModel::KeypointsModel(Net network)
104    private static native long KeypointsModel_2(long network_nativeObj);
105
106    // C++:  vector_Point2f cv::dnn::KeypointsModel::estimate(Mat frame, float thresh = 0.5)
107    private static native long estimate_0(long nativeObj, long frame_nativeObj, float thresh);
108    private static native long estimate_1(long nativeObj, long frame_nativeObj);
109
110    // native support for java finalize()
111    private static native void delete(long nativeObj);
112
113}