Android Open Source - Operation-Valkyrie Cv S V M






From Project

Back to project page Operation-Valkyrie.

License

The source code is released under:

Terms and conditions Preamble: This Agreement, signed on Jun 10, 2012 [hereinafter: Effective Date] governs the relationship between the Enduser, a private person, (hereinafter: Licensee) and Paul N...

If you think the Android project Operation-Valkyrie 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!
///* w w  w  .j ava  2 s . c o  m*/
package org.opencv.ml;

import org.opencv.core.Mat;

// C++: class CvSVM
/**
 * <p>Support Vector Machines.</p>
 *
 * @see <a href="http://docs.opencv.org/modules/ml/doc/support_vector_machines.html#cvsvm">org.opencv.ml.CvSVM : public CvStatModel</a>
 */
public class CvSVM extends CvStatModel {

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


    public static final int
            C_SVC = 100,
            NU_SVC = 101,
            ONE_CLASS = 102,
            EPS_SVR = 103,
            NU_SVR = 104,
            LINEAR = 0,
            POLY = 1,
            RBF = 2,
            SIGMOID = 3,
            C = 0,
            GAMMA = 1,
            P = 2,
            NU = 3,
            COEF = 4,
            DEGREE = 5;


    //
    // C++:   CvSVM::CvSVM()
    //

/**
 * <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/support_vector_machines.html#cvsvm-cvsvm">org.opencv.ml.CvSVM.CvSVM</a>
 */
    public   CvSVM()
    {

        super( CvSVM_0() );

        return;
    }


    //
    // C++:   CvSVM::CvSVM(Mat trainData, Mat responses, Mat varIdx = cv::Mat(), Mat sampleIdx = cv::Mat(), CvSVMParams params = CvSVMParams())
    //

/**
 * <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 responses a responses
 * @param varIdx a varIdx
 * @param sampleIdx a sampleIdx
 * @param params a params
 *
 * @see <a href="http://docs.opencv.org/modules/ml/doc/support_vector_machines.html#cvsvm-cvsvm">org.opencv.ml.CvSVM.CvSVM</a>
 */
    public   CvSVM(Mat trainData, Mat responses, Mat varIdx, Mat sampleIdx, CvSVMParams params)
    {

        super( CvSVM_1(trainData.nativeObj, responses.nativeObj, varIdx.nativeObj, sampleIdx.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 responses a responses
 *
 * @see <a href="http://docs.opencv.org/modules/ml/doc/support_vector_machines.html#cvsvm-cvsvm">org.opencv.ml.CvSVM.CvSVM</a>
 */
    public   CvSVM(Mat trainData, Mat responses)
    {

        super( CvSVM_2(trainData.nativeObj, responses.nativeObj) );

        return;
    }


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

    public  void clear()
    {

        clear_0(nativeObj);

        return;
    }


    //
    // C++:  int CvSVM::get_support_vector_count()
    //

    public  int get_support_vector_count()
    {

        int retVal = get_support_vector_count_0(nativeObj);

        return retVal;
    }


    //
    // C++:  int CvSVM::get_var_count()
    //

/**
 * <p>Returns the number of used features (variables count).</p>
 *
 * @see <a href="http://docs.opencv.org/modules/ml/doc/support_vector_machines.html#cvsvm-get-var-count">org.opencv.ml.CvSVM.get_var_count</a>
 */
    public  int get_var_count()
    {

        int retVal = get_var_count_0(nativeObj);

        return retVal;
    }


    //
    // C++:  float CvSVM::predict(Mat sample, bool returnDFVal = false)
    //

/**
 * <p>Predicts the response for input sample(s).</p>
 *
 * <p>If you pass one sample then prediction result is returned. If you want to get
 * responses for several samples then you should pass the <code>results</code>
 * matrix where prediction results will be stored.</p>
 *
 * <p>The function is parallelized with the TBB library.</p>
 *
 * @param sample Input sample for prediction.
 * @param returnDFVal Specifies a type of the return value. If <code>true</code>
 * and the problem is 2-class classification then the method returns the
 * decision function value that is signed distance to the margin, else the
 * function returns a class label (classification) or estimated function value
 * (regression).
 *
 * @see <a href="http://docs.opencv.org/modules/ml/doc/support_vector_machines.html#cvsvm-predict">org.opencv.ml.CvSVM.predict</a>
 */
    public  float predict(Mat sample, boolean returnDFVal)
    {

        float retVal = predict_0(nativeObj, sample.nativeObj, returnDFVal);

        return retVal;
    }

/**
 * <p>Predicts the response for input sample(s).</p>
 *
 * <p>If you pass one sample then prediction result is returned. If you want to get
 * responses for several samples then you should pass the <code>results</code>
 * matrix where prediction results will be stored.</p>
 *
 * <p>The function is parallelized with the TBB library.</p>
 *
 * @param sample Input sample for prediction.
 *
 * @see <a href="http://docs.opencv.org/modules/ml/doc/support_vector_machines.html#cvsvm-predict">org.opencv.ml.CvSVM.predict</a>
 */
    public  float predict(Mat sample)
    {

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

        return retVal;
    }


    //
    // C++:  bool CvSVM::train(Mat trainData, Mat responses, Mat varIdx = cv::Mat(), Mat sampleIdx = cv::Mat(), CvSVMParams params = CvSVMParams())
    //

/**
 * <p>Trains an SVM.</p>
 *
 * <p>The method trains the SVM model. It follows the conventions of the generic
 * "CvStatModel.train" approach with the following limitations:</p>
 * <ul>
 *   <li> Only the <code>CV_ROW_SAMPLE</code> data layout is supported.
 *   <li> Input variables are all ordered.
 *   <li> Output variables can be either categorical (<code>params.svm_type=CvSVM.C_SVC</code>
 * or <code>params.svm_type=CvSVM.NU_SVC</code>), or ordered (<code>params.svm_type=CvSVM.EPS_SVR</code>
 * or <code>params.svm_type=CvSVM.NU_SVR</code>), or not required at all
 * (<code>params.svm_type=CvSVM.ONE_CLASS</code>).
 *   <li> Missing measurements are not supported.
 * </ul>
 *
 * <p>All the other parameters are gathered in the "CvSVMParams" structure.</p>
 *
 * @param trainData a trainData
 * @param responses a responses
 * @param varIdx a varIdx
 * @param sampleIdx a sampleIdx
 * @param params a params
 *
 * @see <a href="http://docs.opencv.org/modules/ml/doc/support_vector_machines.html#cvsvm-train">org.opencv.ml.CvSVM.train</a>
 */
    public  boolean train(Mat trainData, Mat responses, Mat varIdx, Mat sampleIdx, CvSVMParams params)
    {

        boolean retVal = train_0(nativeObj, trainData.nativeObj, responses.nativeObj, varIdx.nativeObj, sampleIdx.nativeObj, params.nativeObj);

        return retVal;
    }

/**
 * <p>Trains an SVM.</p>
 *
 * <p>The method trains the SVM model. It follows the conventions of the generic
 * "CvStatModel.train" approach with the following limitations:</p>
 * <ul>
 *   <li> Only the <code>CV_ROW_SAMPLE</code> data layout is supported.
 *   <li> Input variables are all ordered.
 *   <li> Output variables can be either categorical (<code>params.svm_type=CvSVM.C_SVC</code>
 * or <code>params.svm_type=CvSVM.NU_SVC</code>), or ordered (<code>params.svm_type=CvSVM.EPS_SVR</code>
 * or <code>params.svm_type=CvSVM.NU_SVR</code>), or not required at all
 * (<code>params.svm_type=CvSVM.ONE_CLASS</code>).
 *   <li> Missing measurements are not supported.
 * </ul>
 *
 * <p>All the other parameters are gathered in the "CvSVMParams" structure.</p>
 *
 * @param trainData a trainData
 * @param responses a responses
 *
 * @see <a href="http://docs.opencv.org/modules/ml/doc/support_vector_machines.html#cvsvm-train">org.opencv.ml.CvSVM.train</a>
 */
    public  boolean train(Mat trainData, Mat responses)
    {

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

        return retVal;
    }


    //
    // C++:  bool CvSVM::train_auto(Mat trainData, Mat responses, Mat varIdx, Mat sampleIdx, CvSVMParams params, int k_fold = 10, CvParamGrid Cgrid = CvSVM::get_default_grid(CvSVM::C), CvParamGrid gammaGrid = CvSVM::get_default_grid(CvSVM::GAMMA), CvParamGrid pGrid = CvSVM::get_default_grid(CvSVM::P), CvParamGrid nuGrid = CvSVM::get_default_grid(CvSVM::NU), CvParamGrid coeffGrid = CvSVM::get_default_grid(CvSVM::COEF), CvParamGrid degreeGrid = CvSVM::get_default_grid(CvSVM::DEGREE), bool balanced = false)
    //

/**
 * <p>Trains an SVM with optimal parameters.</p>
 *
 * <p>The method trains the SVM model automatically by choosing the optimal
 * parameters <code>C</code>, <code>gamma</code>, <code>p</code>,
 * <code>nu</code>, <code>coef0</code>, <code>degree</code> from "CvSVMParams".
 * Parameters are considered optimal when the cross-validation estimate of the
 * test set error is minimal.</p>
 *
 * <p>If there is no need to optimize a parameter, the corresponding grid step
 * should be set to any value less than or equal to 1. For example, to avoid
 * optimization in <code>gamma</code>, set <code>gamma_grid.step = 0</code>,
 * <code>gamma_grid.min_val</code>, <code>gamma_grid.max_val</code> as arbitrary
 * numbers. In this case, the value <code>params.gamma</code> is taken for
 * <code>gamma</code>.</p>
 *
 * <p>And, finally, if the optimization in a parameter is required but the
 * corresponding grid is unknown, you may call the function "CvSVM.get_default_grid".
 * To generate a grid, for example, for <code>gamma</code>, call
 * <code>CvSVM.get_default_grid(CvSVM.GAMMA)</code>.</p>
 *
 * <p>This function works for the classification (<code>params.svm_type=CvSVM.C_SVC</code>
 * or <code>params.svm_type=CvSVM.NU_SVC</code>) as well as for the regression
 * (<code>params.svm_type=CvSVM.EPS_SVR</code> or <code>params.svm_type=CvSVM.NU_SVR</code>).
 * If <code>params.svm_type=CvSVM.ONE_CLASS</code>, no optimization is made and
 * the usual SVM with parameters specified in <code>params</code> is executed.</p>
 *
 * @param trainData a trainData
 * @param responses a responses
 * @param varIdx a varIdx
 * @param sampleIdx a sampleIdx
 * @param params a params
 * @param k_fold Cross-validation parameter. The training set is divided into
 * <code>k_fold</code> subsets. One subset is used to train the model, the
 * others form the test set. So, the SVM algorithm is executed <code>k_fold</code>
 * times.
 * @param Cgrid a Cgrid
 * @param gammaGrid Iteration grid for the corresponding SVM parameter.
 * @param pGrid Iteration grid for the corresponding SVM parameter.
 * @param nuGrid Iteration grid for the corresponding SVM parameter.
 * @param coeffGrid Iteration grid for the corresponding SVM parameter.
 * @param degreeGrid Iteration grid for the corresponding SVM parameter.
 * @param balanced If <code>true</code> and the problem is 2-class
 * classification then the method creates more balanced cross-validation subsets
 * that is proportions between classes in subsets are close to such proportion
 * in the whole train dataset.
 *
 * @see <a href="http://docs.opencv.org/modules/ml/doc/support_vector_machines.html#cvsvm-train-auto">org.opencv.ml.CvSVM.train_auto</a>
 */
    public  boolean train_auto(Mat trainData, Mat responses, Mat varIdx, Mat sampleIdx, CvSVMParams params, int k_fold, CvParamGrid Cgrid, CvParamGrid gammaGrid, CvParamGrid pGrid, CvParamGrid nuGrid, CvParamGrid coeffGrid, CvParamGrid degreeGrid, boolean balanced)
    {

        boolean retVal = train_auto_0(nativeObj, trainData.nativeObj, responses.nativeObj, varIdx.nativeObj, sampleIdx.nativeObj, params.nativeObj, k_fold, Cgrid.nativeObj, gammaGrid.nativeObj, pGrid.nativeObj, nuGrid.nativeObj, coeffGrid.nativeObj, degreeGrid.nativeObj, balanced);

        return retVal;
    }

/**
 * <p>Trains an SVM with optimal parameters.</p>
 *
 * <p>The method trains the SVM model automatically by choosing the optimal
 * parameters <code>C</code>, <code>gamma</code>, <code>p</code>,
 * <code>nu</code>, <code>coef0</code>, <code>degree</code> from "CvSVMParams".
 * Parameters are considered optimal when the cross-validation estimate of the
 * test set error is minimal.</p>
 *
 * <p>If there is no need to optimize a parameter, the corresponding grid step
 * should be set to any value less than or equal to 1. For example, to avoid
 * optimization in <code>gamma</code>, set <code>gamma_grid.step = 0</code>,
 * <code>gamma_grid.min_val</code>, <code>gamma_grid.max_val</code> as arbitrary
 * numbers. In this case, the value <code>params.gamma</code> is taken for
 * <code>gamma</code>.</p>
 *
 * <p>And, finally, if the optimization in a parameter is required but the
 * corresponding grid is unknown, you may call the function "CvSVM.get_default_grid".
 * To generate a grid, for example, for <code>gamma</code>, call
 * <code>CvSVM.get_default_grid(CvSVM.GAMMA)</code>.</p>
 *
 * <p>This function works for the classification (<code>params.svm_type=CvSVM.C_SVC</code>
 * or <code>params.svm_type=CvSVM.NU_SVC</code>) as well as for the regression
 * (<code>params.svm_type=CvSVM.EPS_SVR</code> or <code>params.svm_type=CvSVM.NU_SVR</code>).
 * If <code>params.svm_type=CvSVM.ONE_CLASS</code>, no optimization is made and
 * the usual SVM with parameters specified in <code>params</code> is executed.</p>
 *
 * @param trainData a trainData
 * @param responses a responses
 * @param varIdx a varIdx
 * @param sampleIdx a sampleIdx
 * @param params a params
 *
 * @see <a href="http://docs.opencv.org/modules/ml/doc/support_vector_machines.html#cvsvm-train-auto">org.opencv.ml.CvSVM.train_auto</a>
 */
    public  boolean train_auto(Mat trainData, Mat responses, Mat varIdx, Mat sampleIdx, CvSVMParams params)
    {

        boolean retVal = train_auto_1(nativeObj, trainData.nativeObj, responses.nativeObj, varIdx.nativeObj, sampleIdx.nativeObj, params.nativeObj);

        return retVal;
    }


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



    //
    // native stuff
    //
    static { System.loadLibrary("opencv_java"); }

    // C++:   CvSVM::CvSVM()
    private static native long CvSVM_0();

    // C++:   CvSVM::CvSVM(Mat trainData, Mat responses, Mat varIdx = cv::Mat(), Mat sampleIdx = cv::Mat(), CvSVMParams params = CvSVMParams())
    private static native long CvSVM_1(long trainData_nativeObj, long responses_nativeObj, long varIdx_nativeObj, long sampleIdx_nativeObj, long params_nativeObj);
    private static native long CvSVM_2(long trainData_nativeObj, long responses_nativeObj);

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

    // C++:  int CvSVM::get_support_vector_count()
    private static native int get_support_vector_count_0(long nativeObj);

    // C++:  int CvSVM::get_var_count()
    private static native int get_var_count_0(long nativeObj);

    // C++:  float CvSVM::predict(Mat sample, bool returnDFVal = false)
    private static native float predict_0(long nativeObj, long sample_nativeObj, boolean returnDFVal);
    private static native float predict_1(long nativeObj, long sample_nativeObj);

    // C++:  bool CvSVM::train(Mat trainData, Mat responses, Mat varIdx = cv::Mat(), Mat sampleIdx = cv::Mat(), CvSVMParams params = CvSVMParams())
    private static native boolean train_0(long nativeObj, long trainData_nativeObj, long responses_nativeObj, long varIdx_nativeObj, long sampleIdx_nativeObj, long params_nativeObj);
    private static native boolean train_1(long nativeObj, long trainData_nativeObj, long responses_nativeObj);

    // C++:  bool CvSVM::train_auto(Mat trainData, Mat responses, Mat varIdx, Mat sampleIdx, CvSVMParams params, int k_fold = 10, CvParamGrid Cgrid = CvSVM::get_default_grid(CvSVM::C), CvParamGrid gammaGrid = CvSVM::get_default_grid(CvSVM::GAMMA), CvParamGrid pGrid = CvSVM::get_default_grid(CvSVM::P), CvParamGrid nuGrid = CvSVM::get_default_grid(CvSVM::NU), CvParamGrid coeffGrid = CvSVM::get_default_grid(CvSVM::COEF), CvParamGrid degreeGrid = CvSVM::get_default_grid(CvSVM::DEGREE), bool balanced = false)
    private static native boolean train_auto_0(long nativeObj, long trainData_nativeObj, long responses_nativeObj, long varIdx_nativeObj, long sampleIdx_nativeObj, long params_nativeObj, int k_fold, long Cgrid_nativeObj, long gammaGrid_nativeObj, long pGrid_nativeObj, long nuGrid_nativeObj, long coeffGrid_nativeObj, long degreeGrid_nativeObj, boolean balanced);
    private static native boolean train_auto_1(long nativeObj, long trainData_nativeObj, long responses_nativeObj, long varIdx_nativeObj, long sampleIdx_nativeObj, long params_nativeObj);

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

}




Java Source Code List

org.opencv.android.Utils.java
org.opencv.calib3d.Calib3d.java
org.opencv.calib3d.StereoBM.java
org.opencv.calib3d.StereoSGBM.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.highgui.Highgui.java
org.opencv.highgui.VideoCapture.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.BackgroundSubtractorMOG.java
org.opencv.video.BackgroundSubtractor.java
org.opencv.video.KalmanFilter.java
org.opencv.video.Video.java
valkyrie.colorpicker.ColorPickerDialog.java
valkyrie.colorpicker.ColorPicker.java
valkyrie.file.DecodeBitmaps.java
valkyrie.file.FileManager.java
valkyrie.filter.FilterAssets.java
valkyrie.filter.FilterInternalStorage.java
valkyrie.filter.FilterManager.java
valkyrie.filter.FilterUIPosition.java
valkyrie.filter.IFilter.java
valkyrie.filter.ascii.Ascii.java
valkyrie.filter.ascii.Converter.java
valkyrie.filter.ascii.Font.java
valkyrie.filter.ascii.Options.java
valkyrie.filter.canny.Canny.java
valkyrie.filter.grayscale.Grayscale.java
valkyrie.filter.nofilter.NoFilter.java
valkyrie.ui.IUpdateableUI.java
valkyrie.ui.LayoutManager.java
valkyrie.ui.MainActivity.java
valkyrie.ui.UpdateableRelativeLayout.java
valkyrie.ui.gallery.AboutActivity.java
valkyrie.ui.gallery.GalleryActivity.java
valkyrie.ui.gallery.ImageAdapter.java
valkyrie.ui.gallery.ShowPicActivity.java
valkyrie.ui.preview.CameraPreviewViewCV.java
valkyrie.widget.MultiDirectionSlidingDrawer.java
valkyrie.widget.TouchImageView.java