Android Open Source - android-opencv-template Cv G B Trees






From Project

Back to project page android-opencv-template.

License

The source code is released under:

MIT License

If you think the Android project android-opencv-template listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

//
// This file is auto-generated. Please don't modify it!
////from w  ww  .  j  a  v a2 s . co  m
package org.opencv.ml;

import org.opencv.core.Mat;
import org.opencv.core.Range;

// C++: class CvGBTrees
/**
 * <p>The class implements the Gradient boosted tree model as described in the
 * beginning of this section.</p>
 *
 * @see <a href="http://docs.opencv.org/modules/ml/doc/gradient_boosted_trees.html#cvgbtrees">org.opencv.ml.CvGBTrees : public CvStatModel</a>
 */
public class CvGBTrees extends CvStatModel {

    protected CvGBTrees(long addr) { super(addr); }


    public static final int
            SQUARED_LOSS = 0,
            ABSOLUTE_LOSS = 0+1,
            HUBER_LOSS = 3,
            DEVIANCE_LOSS = 3+1;


    //
    // C++:   CvGBTrees::CvGBTrees()
    //

/**
 * <p>Default and training constructors.</p>
 *
 * <p>The constructors follow conventions of "CvStatModel.CvStatModel". See
 * "CvStatModel.train" for parameters descriptions.</p>
 *
 * @see <a href="http://docs.opencv.org/modules/ml/doc/gradient_boosted_trees.html#cvgbtrees-cvgbtrees">org.opencv.ml.CvGBTrees.CvGBTrees</a>
 */
    public   CvGBTrees()
    {

        super( CvGBTrees_0() );

        return;
    }


    //
    // C++:   CvGBTrees::CvGBTrees(Mat trainData, int tflag, Mat responses, Mat varIdx = cv::Mat(), Mat sampleIdx = cv::Mat(), Mat varType = cv::Mat(), Mat missingDataMask = cv::Mat(), CvGBTreesParams params = CvGBTreesParams())
    //

/**
 * <p>Default and training constructors.</p>
 *
 * <p>The constructors follow conventions of "CvStatModel.CvStatModel". See
 * "CvStatModel.train" for parameters descriptions.</p>
 *
 * @param trainData a trainData
 * @param tflag a tflag
 * @param responses a responses
 * @param varIdx a varIdx
 * @param sampleIdx a sampleIdx
 * @param varType a varType
 * @param missingDataMask a missingDataMask
 * @param params a params
 *
 * @see <a href="http://docs.opencv.org/modules/ml/doc/gradient_boosted_trees.html#cvgbtrees-cvgbtrees">org.opencv.ml.CvGBTrees.CvGBTrees</a>
 */
    public   CvGBTrees(Mat trainData, int tflag, Mat responses, Mat varIdx, Mat sampleIdx, Mat varType, Mat missingDataMask, CvGBTreesParams params)
    {

        super( CvGBTrees_1(trainData.nativeObj, tflag, responses.nativeObj, varIdx.nativeObj, sampleIdx.nativeObj, varType.nativeObj, missingDataMask.nativeObj, params.nativeObj) );

        return;
    }

/**
 * <p>Default and training constructors.</p>
 *
 * <p>The constructors follow conventions of "CvStatModel.CvStatModel". See
 * "CvStatModel.train" for parameters descriptions.</p>
 *
 * @param trainData a trainData
 * @param tflag a tflag
 * @param responses a responses
 *
 * @see <a href="http://docs.opencv.org/modules/ml/doc/gradient_boosted_trees.html#cvgbtrees-cvgbtrees">org.opencv.ml.CvGBTrees.CvGBTrees</a>
 */
    public   CvGBTrees(Mat trainData, int tflag, Mat responses)
    {

        super( CvGBTrees_2(trainData.nativeObj, tflag, responses.nativeObj) );

        return;
    }


    //
    // C++:  void CvGBTrees::clear()
    //

/**
 * <p>Clears the model.</p>
 *
 * <p>The function deletes the data set information and all the weak models and
 * sets all internal variables to the initial state. The function is called in
 * "CvGBTrees.train" and in the destructor.</p>
 *
 * @see <a href="http://docs.opencv.org/modules/ml/doc/gradient_boosted_trees.html#cvgbtrees-clear">org.opencv.ml.CvGBTrees.clear</a>
 */
    public  void clear()
    {

        clear_0(nativeObj);

        return;
    }


    //
    // C++:  float CvGBTrees::predict(Mat sample, Mat missing = cv::Mat(), Range slice = cv::Range::all(), int k = -1)
    //

/**
 * <p>Predicts a response for an input sample.</p>
 *
 * <p>The method predicts the response corresponding to the given sample (see
 * "Predicting with GBT").
 * The result is either the class label or the estimated function value. The
 * "CvGBTrees.predict" method enables using the parallel version of the GBT
 * model prediction if the OpenCV is built with the TBB library. In this case,
 * predictions of single trees are computed in a parallel fashion.</p>
 *
 * @param sample Input feature vector that has the same format as every training
 * set element. If not all the variables were actually used during training,
 * <code>sample</code> contains forged values at the appropriate places.
 * @param missing Missing values mask, which is a dimensional matrix of the same
 * size as <code>sample</code> having the <code>CV_8U</code> type.
 * <code>1</code> corresponds to the missing value in the same position in the
 * <code>sample</code> vector. If there are no missing values in the feature
 * vector, an empty matrix can be passed instead of the missing mask.
 * @param slice Parameter defining the part of the ensemble used for prediction.
 * <p>If <code>slice = Range.all()</code>, all trees are used. Use this parameter
 * to get predictions of the GBT models with different ensemble sizes learning
 * only one model.</p>
 * @param k Number of tree ensembles built in case of the classification problem
 * (see "Training GBT"). Use this parameter to change the output to sum of the
 * trees' predictions in the <code>k</code>-th ensemble only. To get the total
 * GBT model prediction, <code>k</code> value must be -1. For regression
 * problems, <code>k</code> is also equal to -1.
 *
 * @see <a href="http://docs.opencv.org/modules/ml/doc/gradient_boosted_trees.html#cvgbtrees-predict">org.opencv.ml.CvGBTrees.predict</a>
 */
    public  float predict(Mat sample, Mat missing, Range slice, int k)
    {

        float retVal = predict_0(nativeObj, sample.nativeObj, missing.nativeObj, slice.start, slice.end, k);

        return retVal;
    }

/**
 * <p>Predicts a response for an input sample.</p>
 *
 * <p>The method predicts the response corresponding to the given sample (see
 * "Predicting with GBT").
 * The result is either the class label or the estimated function value. The
 * "CvGBTrees.predict" method enables using the parallel version of the GBT
 * model prediction if the OpenCV is built with the TBB library. In this case,
 * predictions of single trees are computed in a parallel fashion.</p>
 *
 * @param sample Input feature vector that has the same format as every training
 * set element. If not all the variables were actually used during training,
 * <code>sample</code> contains forged values at the appropriate places.
 *
 * @see <a href="http://docs.opencv.org/modules/ml/doc/gradient_boosted_trees.html#cvgbtrees-predict">org.opencv.ml.CvGBTrees.predict</a>
 */
    public  float predict(Mat sample)
    {

        float retVal = predict_1(nativeObj, sample.nativeObj);

        return retVal;
    }


    //
    // C++:  bool CvGBTrees::train(Mat trainData, int tflag, Mat responses, Mat varIdx = cv::Mat(), Mat sampleIdx = cv::Mat(), Mat varType = cv::Mat(), Mat missingDataMask = cv::Mat(), CvGBTreesParams params = CvGBTreesParams(), bool update = false)
    //

/**
 * <p>Trains a Gradient boosted tree model.</p>
 *
 * <p>The first train method follows the common template (see "CvStatModel.train").
 * Both <code>tflag</code> values (<code>CV_ROW_SAMPLE</code>, <code>CV_COL_SAMPLE</code>)
 * are supported.
 * <code>trainData</code> must be of the <code>CV_32F</code> type.
 * <code>responses</code> must be a matrix of type <code>CV_32S</code> or
 * <code>CV_32F</code>. In both cases it is converted into the <code>CV_32F</code>
 * matrix inside the training procedure. <code>varIdx</code> and
 * <code>sampleIdx</code> must be a list of indices (<code>CV_32S</code>) or a
 * mask (<code>CV_8U</code> or <code>CV_8S</code>). <code>update</code> is a
 * dummy parameter.</p>
 *
 * <p>The second form of "CvGBTrees.train" function uses "CvMLData" as a data set
 * container. <code>update</code> is still a dummy parameter.</p>
 *
 * <p>All parameters specific to the GBT model are passed into the training
 * function as a "CvGBTreesParams" structure.</p>
 *
 * @param trainData a trainData
 * @param tflag a tflag
 * @param responses a responses
 * @param varIdx a varIdx
 * @param sampleIdx a sampleIdx
 * @param varType a varType
 * @param missingDataMask a missingDataMask
 * @param params a params
 * @param update a update
 *
 * @see <a href="http://docs.opencv.org/modules/ml/doc/gradient_boosted_trees.html#cvgbtrees-train">org.opencv.ml.CvGBTrees.train</a>
 */
    public  boolean train(Mat trainData, int tflag, Mat responses, Mat varIdx, Mat sampleIdx, Mat varType, Mat missingDataMask, CvGBTreesParams params, boolean update)
    {

        boolean retVal = train_0(nativeObj, trainData.nativeObj, tflag, responses.nativeObj, varIdx.nativeObj, sampleIdx.nativeObj, varType.nativeObj, missingDataMask.nativeObj, params.nativeObj, update);

        return retVal;
    }

/**
 * <p>Trains a Gradient boosted tree model.</p>
 *
 * <p>The first train method follows the common template (see "CvStatModel.train").
 * Both <code>tflag</code> values (<code>CV_ROW_SAMPLE</code>, <code>CV_COL_SAMPLE</code>)
 * are supported.
 * <code>trainData</code> must be of the <code>CV_32F</code> type.
 * <code>responses</code> must be a matrix of type <code>CV_32S</code> or
 * <code>CV_32F</code>. In both cases it is converted into the <code>CV_32F</code>
 * matrix inside the training procedure. <code>varIdx</code> and
 * <code>sampleIdx</code> must be a list of indices (<code>CV_32S</code>) or a
 * mask (<code>CV_8U</code> or <code>CV_8S</code>). <code>update</code> is a
 * dummy parameter.</p>
 *
 * <p>The second form of "CvGBTrees.train" function uses "CvMLData" as a data set
 * container. <code>update</code> is still a dummy parameter.</p>
 *
 * <p>All parameters specific to the GBT model are passed into the training
 * function as a "CvGBTreesParams" structure.</p>
 *
 * @param trainData a trainData
 * @param tflag a tflag
 * @param responses a responses
 *
 * @see <a href="http://docs.opencv.org/modules/ml/doc/gradient_boosted_trees.html#cvgbtrees-train">org.opencv.ml.CvGBTrees.train</a>
 */
    public  boolean train(Mat trainData, int tflag, Mat responses)
    {

        boolean retVal = train_1(nativeObj, trainData.nativeObj, tflag, responses.nativeObj);

        return retVal;
    }


    @Override
    protected void finalize() throws Throwable {
        delete(nativeObj);
    }



    // C++:   CvGBTrees::CvGBTrees()
    private static native long CvGBTrees_0();

    // C++:   CvGBTrees::CvGBTrees(Mat trainData, int tflag, Mat responses, Mat varIdx = cv::Mat(), Mat sampleIdx = cv::Mat(), Mat varType = cv::Mat(), Mat missingDataMask = cv::Mat(), CvGBTreesParams params = CvGBTreesParams())
    private static native long CvGBTrees_1(long trainData_nativeObj, int tflag, long responses_nativeObj, long varIdx_nativeObj, long sampleIdx_nativeObj, long varType_nativeObj, long missingDataMask_nativeObj, long params_nativeObj);
    private static native long CvGBTrees_2(long trainData_nativeObj, int tflag, long responses_nativeObj);

    // C++:  void CvGBTrees::clear()
    private static native void clear_0(long nativeObj);

    // C++:  float CvGBTrees::predict(Mat sample, Mat missing = cv::Mat(), Range slice = cv::Range::all(), int k = -1)
    private static native float predict_0(long nativeObj, long sample_nativeObj, long missing_nativeObj, int slice_start, int slice_end, int k);
    private static native float predict_1(long nativeObj, long sample_nativeObj);

    // C++:  bool CvGBTrees::train(Mat trainData, int tflag, Mat responses, Mat varIdx = cv::Mat(), Mat sampleIdx = cv::Mat(), Mat varType = cv::Mat(), Mat missingDataMask = cv::Mat(), CvGBTreesParams params = CvGBTreesParams(), bool update = false)
    private static native boolean train_0(long nativeObj, long trainData_nativeObj, int tflag, long responses_nativeObj, long varIdx_nativeObj, long sampleIdx_nativeObj, long varType_nativeObj, long missingDataMask_nativeObj, long params_nativeObj, boolean update);
    private static native boolean train_1(long nativeObj, long trainData_nativeObj, int tflag, long responses_nativeObj);

    // native support for java finalize()
    private static native void delete(long nativeObj);

}




Java Source Code List

com.floatlearning.android_opencv_template.MainActivity.java
org.opencv.android.AsyncServiceHelper.java
org.opencv.android.BaseLoaderCallback.java
org.opencv.android.CameraBridgeViewBase.java
org.opencv.android.FpsMeter.java
org.opencv.android.InstallCallbackInterface.java
org.opencv.android.JavaCameraView.java
org.opencv.android.LoaderCallbackInterface.java
org.opencv.android.NativeCameraView.java
org.opencv.android.OpenCVLoader.java
org.opencv.android.StaticHelper.java
org.opencv.android.Utils.java
org.opencv.calib3d.Calib3d.java
org.opencv.calib3d.StereoBM.java
org.opencv.calib3d.StereoSGBM.java
org.opencv.contrib.Contrib.java
org.opencv.contrib.FaceRecognizer.java
org.opencv.contrib.StereoVar.java
org.opencv.core.Algorithm.java
org.opencv.core.Core.java
org.opencv.core.CvException.java
org.opencv.core.CvType.java
org.opencv.core.MatOfByte.java
org.opencv.core.MatOfDMatch.java
org.opencv.core.MatOfDouble.java
org.opencv.core.MatOfFloat4.java
org.opencv.core.MatOfFloat6.java
org.opencv.core.MatOfFloat.java
org.opencv.core.MatOfInt4.java
org.opencv.core.MatOfInt.java
org.opencv.core.MatOfKeyPoint.java
org.opencv.core.MatOfPoint2f.java
org.opencv.core.MatOfPoint3.java
org.opencv.core.MatOfPoint3f.java
org.opencv.core.MatOfPoint.java
org.opencv.core.MatOfRect.java
org.opencv.core.Mat.java
org.opencv.core.Point3.java
org.opencv.core.Point.java
org.opencv.core.Range.java
org.opencv.core.Rect.java
org.opencv.core.RotatedRect.java
org.opencv.core.Scalar.java
org.opencv.core.Size.java
org.opencv.core.TermCriteria.java
org.opencv.features2d.DMatch.java
org.opencv.features2d.DescriptorExtractor.java
org.opencv.features2d.DescriptorMatcher.java
org.opencv.features2d.FeatureDetector.java
org.opencv.features2d.Features2d.java
org.opencv.features2d.GenericDescriptorMatcher.java
org.opencv.features2d.KeyPoint.java
org.opencv.gpu.DeviceInfo.java
org.opencv.gpu.Gpu.java
org.opencv.gpu.TargetArchs.java
org.opencv.highgui.Highgui.java
org.opencv.highgui.VideoCapture.java
org.opencv.imgproc.CLAHE.java
org.opencv.imgproc.Imgproc.java
org.opencv.imgproc.Moments.java
org.opencv.imgproc.Subdiv2D.java
org.opencv.ml.CvANN_MLP_TrainParams.java
org.opencv.ml.CvANN_MLP.java
org.opencv.ml.CvBoostParams.java
org.opencv.ml.CvBoost.java
org.opencv.ml.CvDTreeParams.java
org.opencv.ml.CvDTree.java
org.opencv.ml.CvERTrees.java
org.opencv.ml.CvGBTreesParams.java
org.opencv.ml.CvGBTrees.java
org.opencv.ml.CvKNearest.java
org.opencv.ml.CvNormalBayesClassifier.java
org.opencv.ml.CvParamGrid.java
org.opencv.ml.CvRTParams.java
org.opencv.ml.CvRTrees.java
org.opencv.ml.CvSVMParams.java
org.opencv.ml.CvSVM.java
org.opencv.ml.CvStatModel.java
org.opencv.ml.EM.java
org.opencv.ml.Ml.java
org.opencv.objdetect.CascadeClassifier.java
org.opencv.objdetect.HOGDescriptor.java
org.opencv.objdetect.Objdetect.java
org.opencv.photo.Photo.java
org.opencv.utils.Converters.java
org.opencv.video.BackgroundSubtractorMOG2.java
org.opencv.video.BackgroundSubtractorMOG.java
org.opencv.video.BackgroundSubtractor.java
org.opencv.video.KalmanFilter.java
org.opencv.video.Video.java