java类org.opencv.core.Range的实例源码

ComparisonFrameRender.java 文件源码 项目:OpenCV-AndroidSamples-master 阅读 21 收藏 0 点赞 0 评论 0
@Override
public Mat render(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {
    Mat undistortedFrame = new Mat(inputFrame.rgba().size(), inputFrame.rgba().type());
    Imgproc.undistort(inputFrame.rgba(), undistortedFrame,
            mCalibrator.getCameraMatrix(), mCalibrator.getDistortionCoefficients());

    Mat comparisonFrame = inputFrame.rgba();
    undistortedFrame.colRange(new Range(0, mWidth / 2)).copyTo(comparisonFrame.colRange(new Range(mWidth / 2, mWidth)));
    List<MatOfPoint> border = new ArrayList<MatOfPoint>();
    final int shift = (int)(mWidth * 0.005);
    border.add(new MatOfPoint(new Point(mWidth / 2 - shift, 0), new Point(mWidth / 2 + shift, 0),
            new Point(mWidth / 2 + shift, mHeight), new Point(mWidth / 2 - shift, mHeight)));
    Imgproc.fillPoly(comparisonFrame, border, new Scalar(255, 255, 255));

    Imgproc.putText(comparisonFrame, mResources.getString(R.string.original), new Point(mWidth * 0.1, mHeight * 0.1),
            Core.FONT_HERSHEY_SIMPLEX, 1.0, new Scalar(255, 255, 0));
    Imgproc.putText(comparisonFrame, mResources.getString(R.string.undistorted), new Point(mWidth * 0.6, mHeight * 0.1),
            Core.FONT_HERSHEY_SIMPLEX, 1.0, new Scalar(255, 255, 0));

    return comparisonFrame;
}
ComparisonFrameRender.java 文件源码 项目:Aruco-Marker-Tracking-Android 阅读 17 收藏 0 点赞 0 评论 0
@Override
public Mat render(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {
    Mat undistortedFrame = new Mat(inputFrame.rgba().size(), inputFrame.rgba().type());
    Imgproc.undistort(inputFrame.rgba(), undistortedFrame,
            mCalibrator.getCameraMatrix(), mCalibrator.getDistortionCoefficients());

    Mat comparisonFrame = inputFrame.rgba();
    undistortedFrame.colRange(new Range(0, mWidth / 2)).copyTo(comparisonFrame.colRange(new Range(mWidth / 2, mWidth)));
    List<MatOfPoint> border = new ArrayList<MatOfPoint>();
    final int shift = (int)(mWidth * 0.005);
    border.add(new MatOfPoint(new Point(mWidth / 2 - shift, 0), new Point(mWidth / 2 + shift, 0),
            new Point(mWidth / 2 + shift, mHeight), new Point(mWidth / 2 - shift, mHeight)));
    Core.fillPoly(comparisonFrame, border, new Scalar(255, 255, 255));

    Core.putText(comparisonFrame, mResources.getString(R.string.original), new Point(mWidth * 0.1, mHeight * 0.1),
            Core.FONT_HERSHEY_SIMPLEX, 1.0, new Scalar(255, 255, 0));
    Core.putText(comparisonFrame, mResources.getString(R.string.undistorted), new Point(mWidth * 0.6, mHeight * 0.1),
            Core.FONT_HERSHEY_SIMPLEX, 1.0, new Scalar(255, 255, 0));

    return comparisonFrame;
}
ComparisonFrameRender.java 文件源码 项目:OpenCV-AndroidSamples 阅读 19 收藏 0 点赞 0 评论 0
@Override
public Mat render(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {
    Mat undistortedFrame = new Mat(inputFrame.rgba().size(), inputFrame.rgba().type());
    Imgproc.undistort(inputFrame.rgba(), undistortedFrame,
            mCalibrator.getCameraMatrix(), mCalibrator.getDistortionCoefficients());

    Mat comparisonFrame = inputFrame.rgba();
    undistortedFrame.colRange(new Range(0, mWidth / 2)).copyTo(comparisonFrame.colRange(new Range(mWidth / 2, mWidth)));
    List<MatOfPoint> border = new ArrayList<MatOfPoint>();
    final int shift = (int)(mWidth * 0.005);
    border.add(new MatOfPoint(new Point(mWidth / 2 - shift, 0), new Point(mWidth / 2 + shift, 0),
            new Point(mWidth / 2 + shift, mHeight), new Point(mWidth / 2 - shift, mHeight)));
    Imgproc.fillPoly(comparisonFrame, border, new Scalar(255, 255, 255));

    Imgproc.putText(comparisonFrame, mResources.getString(R.string.original), new Point(mWidth * 0.1, mHeight * 0.1),
            Core.FONT_HERSHEY_SIMPLEX, 1.0, new Scalar(255, 255, 0));
    Imgproc.putText(comparisonFrame, mResources.getString(R.string.undistorted), new Point(mWidth * 0.6, mHeight * 0.1),
            Core.FONT_HERSHEY_SIMPLEX, 1.0, new Scalar(255, 255, 0));

    return comparisonFrame;
}
BackProjectionActivity.java 文件源码 项目:OpenCV-BackProjection 阅读 17 收藏 0 点赞 0 评论 0
public void onCameraViewStarted(int width, int height) {
    mRgba = new Mat(height, width, CvType.CV_8UC3);
    mHSV = new Mat();

    mIntermediateMat = new Mat();
    mGray = new Mat(height, width, CvType.CV_8UC1);

    mask2  = Mat.zeros( mRgba.rows() + 2, mRgba.cols() + 2, CvType.CV_8UC1 );
    newVal = new Scalar( 120, 120, 120 );
    loDiff = new Scalar( lo, lo, lo );
    upDiff = new Scalar( up, up, up );

    rowRange = new Range( 1, mask2.rows() - 1 );
    colRange = new Range( 1, mask2.cols() - 1 );

    mBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);        
}
ImageProcessing.java 文件源码 项目:fingerblox 阅读 45 收藏 0 点赞 0 评论 0
private Mat cropFingerprint(Mat src) {
    int rowStart = (int) (CameraOverlayView.PADDING * src.rows());
    int rowEnd = (int) ((1 - CameraOverlayView.PADDING) * src.rows());
    int colStart = (int) (CameraOverlayView.PADDING * src.cols());
    int colEnd = (int) ((1 - CameraOverlayView.PADDING) * src.cols());
    Range rowRange = new Range(rowStart, rowEnd);
    Range colRange = new Range(colStart, colEnd);
    return src.submat(rowRange, colRange);
}
ImgprocessUtils.java 文件源码 项目:classchecks 阅读 25 收藏 0 点赞 0 评论 0
/**
 * 其主要思路为:
    1、求取源图I的平均灰度,并记录rows和cols;
    2、按照一定大小,分为N*M个方块,求出每块的平均值,得到子块的亮度矩阵D;
    3、用矩阵D的每个元素减去源图的平均灰度,得到子块的亮度差值矩阵E;
    4、用双立方差值法,将矩阵E差值成与源图一样大小的亮度分布矩阵R;
    5、得到矫正后的图像result=I-R;
* @Title: unevenLightCompensate 
* @Description: 光线补偿 
* @param image
* @param blockSize
* void 
* @throws
 */
public static void unevenLightCompensate(Mat image, int blockSize) {
    if(image.channels() == 3) {
        Imgproc.cvtColor(image, image, 7);
    }
    double average = Core.mean(image).val[0];
    Scalar scalar = new Scalar(average);
    int rowsNew = (int) Math.ceil((double)image.rows() / (double)blockSize);
    int colsNew = (int) Math.ceil((double)image.cols() / (double)blockSize);
    Mat blockImage = new Mat();
    blockImage = Mat.zeros(rowsNew, colsNew, CvType.CV_32FC1);
    for(int i = 0; i < rowsNew; i ++) {
        for(int j = 0; j < colsNew; j ++) {
            int rowmin = i * blockSize;
            int rowmax = (i + 1) * blockSize;
            if(rowmax > image.rows()) rowmax = image.rows();
            int colmin = j * blockSize;
            int colmax = (j +1) * blockSize;
            if(colmax > image.cols()) colmax = image.cols();
            Range rangeRow = new Range(rowmin, rowmax);
            Range rangeCol = new Range(colmin, colmax);
            Mat imageROI = new Mat(image, rangeRow, rangeCol);
            double temaver = Core.mean(imageROI).val[0];
            blockImage.put(i, j, temaver);
        }
    }

    Core.subtract(blockImage, scalar, blockImage);
    Mat blockImage2 = new Mat();
    int INTER_CUBIC = 2;
    Imgproc.resize(blockImage, blockImage2, image.size(), 0, 0, INTER_CUBIC);
    Mat image2 = new Mat();
    image.convertTo(image2, CvType.CV_32FC1);
    Mat dst = new Mat();
    Core.subtract(image2, blockImage2, dst);
    dst.convertTo(image, CvType.CV_8UC1);
}
CVProcessor.java 文件源码 项目:CVScanner 阅读 17 收藏 0 点赞 0 评论 0
public static Rect detectBorder(Mat original){
    Mat src = original.clone();
    Log.d(TAG, "1 original: " + src.toString());

    Imgproc.GaussianBlur(src, src, new Size(3, 3), 0);
    Log.d(TAG, "2.1 --> Gaussian blur done\n blur: " + src.toString());

    Imgproc.cvtColor(src, src, Imgproc.COLOR_RGBA2GRAY);
    Log.d(TAG, "2.2 --> Grayscaling done\n gray: " + src.toString());

    Mat sobelX = new Mat();
    Mat sobelY = new Mat();

    Imgproc.Sobel(src, sobelX, CvType.CV_32FC1, 2, 0, 5, 1, 0);
    Log.d(TAG, "3.1 --> Sobel done.\n X: " + sobelX.toString());
    Imgproc.Sobel(src, sobelY, CvType.CV_32FC1, 0, 2, 5, 1, 0);
    Log.d(TAG, "3.2 --> Sobel done.\n Y: " + sobelY.toString());

    Mat sum_img = new Mat();
    Core.addWeighted(sobelX, 0.5, sobelY, 0.5, 0.5, sum_img);
    //Core.add(sobelX, sobelY, sum_img);
    Log.d(TAG, "4 --> Addition done. sum: " + sum_img.toString());

    sobelX.release();
    sobelY.release();

    Mat gray = new Mat();
    Core.normalize(sum_img, gray, 0, 255, Core.NORM_MINMAX, CvType.CV_8UC1);
    Log.d(TAG, "5 --> Normalization done. gray: " + gray.toString());
    sum_img.release();

    Mat row_proj = new Mat();
    Mat col_proj = new Mat();
    Core.reduce(gray, row_proj, 1, Core.REDUCE_AVG, CvType.CV_8UC1);
    Log.d(TAG, "6.1 --> Reduce done. row: " + row_proj.toString());

    Core.reduce(gray, col_proj, 0, Core.REDUCE_AVG, CvType.CV_8UC1);
    Log.d(TAG, "6.2 --> Reduce done. col: " + col_proj.toString());
    gray.release();

    Imgproc.Sobel(row_proj, row_proj, CvType.CV_8UC1, 0, 2);
    Log.d(TAG, "7.1 --> Sobel done. row: " + row_proj.toString());

    Imgproc.Sobel(col_proj, col_proj, CvType.CV_8UC1, 2, 0);
    Log.d(TAG, "7.2 --> Sobel done. col: " + col_proj.toString());

    Rect result = new Rect();

    int half_pos = (int) (row_proj.total()/2);
    Mat row_sub = new Mat(row_proj, new Range(0, half_pos), new Range(0, 1));
    Log.d(TAG, "8.1 --> Copy sub matrix done. row: " + row_sub.toString());
    result.y = (int) Core.minMaxLoc(row_sub).maxLoc.y;
    Log.d(TAG, "8.2 --> Minmax done. Y: " + result.y);
    row_sub.release();
    Mat row_sub2 = new Mat(row_proj, new Range(half_pos, (int) row_proj.total()), new Range(0, 1));
    Log.d(TAG, "8.3 --> Copy sub matrix done. row: " + row_sub2.toString());
    result.height = (int) (Core.minMaxLoc(row_sub2).maxLoc.y + half_pos - result.y);
    Log.d(TAG, "8.4 --> Minmax done. Height: " + result.height);
    row_sub2.release();

    half_pos = (int) (col_proj.total()/2);
    Mat col_sub = new Mat(col_proj, new Range(0, 1), new Range(0, half_pos));
    Log.d(TAG, "9.1 --> Copy sub matrix done. col: " + col_sub.toString());
    result.x = (int) Core.minMaxLoc(col_sub).maxLoc.x;
    Log.d(TAG, "9.2 --> Minmax done. X: " + result.x);
    col_sub.release();
    Mat col_sub2 = new Mat(col_proj, new Range(0, 1), new Range(half_pos, (int) col_proj.total()));
    Log.d(TAG, "9.3 --> Copy sub matrix done. col: " + col_sub2.toString());
    result.width = (int) (Core.minMaxLoc(col_sub2).maxLoc.x + half_pos - result.x);
    Log.d(TAG, "9.4 --> Minmax done. Width: " + result.width);
    col_sub2.release();

    row_proj.release();
    col_proj.release();
    src.release();

    return result;
}
CvGBTrees.java 文件源码 项目:TinyPlanetMaker 阅读 22 收藏 0 点赞 0 评论 0
/**
* <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;
   }
CvBoost.java 文件源码 项目:TinyPlanetMaker 阅读 20 收藏 0 点赞 0 评论 0
/**
* <p>Predicts a response for an input sample.</p>
*
* <p>The method runs the sample through the trees in the ensemble and returns the
* output class label based on the weighted voting.</p>
*
* @param sample Input sample.
* @param missing Optional mask of missing measurements. To handle missing
* measurements, the weak classifiers must include surrogate splits (see
* <code>CvDTreeParams.use_surrogates</code>).
* @param slice Continuous subset of the sequence of weak classifiers to be used
* for prediction. By default, all the weak classifiers are used.
* @param rawMode Normally, it should be set to <code>false</code>.
* @param returnSum If <code>true</code> then return sum of votes instead of the
* class label.
*
* @see <a href="http://docs.opencv.org/modules/ml/doc/boosting.html#cvboost-predict">org.opencv.ml.CvBoost.predict</a>
*/
   public  float predict(Mat sample, Mat missing, Range slice, boolean rawMode, boolean returnSum)
   {

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

       return retVal;
   }
CvBoost.java 文件源码 项目:TinyPlanetMaker 阅读 17 收藏 0 点赞 0 评论 0
/**
* <p>Removes the specified weak classifiers.</p>
*
* <p>The method removes the specified weak classifiers from the sequence.</p>
*
* <p>Note: Do not confuse this method with the pruning of individual decision
* trees, which is currently not supported.</p>
*
* @param slice Continuous subset of the sequence of weak classifiers to be
* removed.
*
* @see <a href="http://docs.opencv.org/modules/ml/doc/boosting.html#cvboost-prune">org.opencv.ml.CvBoost.prune</a>
*/
   public  void prune(Range slice)
   {

       prune_0(nativeObj, slice.start, slice.end);

       return;
   }
CvGBTrees.java 文件源码 项目:android-things-drawbot 阅读 17 收藏 0 点赞 0 评论 0
/**
* <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;
   }
CvBoost.java 文件源码 项目:android-things-drawbot 阅读 21 收藏 0 点赞 0 评论 0
/**
* <p>Predicts a response for an input sample.</p>
*
* <p>The method runs the sample through the trees in the ensemble and returns the
* output class label based on the weighted voting.</p>
*
* @param sample Input sample.
* @param missing Optional mask of missing measurements. To handle missing
* measurements, the weak classifiers must include surrogate splits (see
* <code>CvDTreeParams.use_surrogates</code>).
* @param slice Continuous subset of the sequence of weak classifiers to be used
* for prediction. By default, all the weak classifiers are used.
* @param rawMode Normally, it should be set to <code>false</code>.
* @param returnSum If <code>true</code> then return sum of votes instead of the
* class label.
*
* @see <a href="http://docs.opencv.org/modules/ml/doc/boosting.html#cvboost-predict">org.opencv.ml.CvBoost.predict</a>
*/
   public  float predict(Mat sample, Mat missing, Range slice, boolean rawMode, boolean returnSum)
   {

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

       return retVal;
   }
CvBoost.java 文件源码 项目:android-things-drawbot 阅读 16 收藏 0 点赞 0 评论 0
/**
* <p>Removes the specified weak classifiers.</p>
*
* <p>The method removes the specified weak classifiers from the sequence.</p>
*
* <p>Note: Do not confuse this method with the pruning of individual decision
* trees, which is currently not supported.</p>
*
* @param slice Continuous subset of the sequence of weak classifiers to be
* removed.
*
* @see <a href="http://docs.opencv.org/modules/ml/doc/boosting.html#cvboost-prune">org.opencv.ml.CvBoost.prune</a>
*/
   public  void prune(Range slice)
   {

       prune_0(nativeObj, slice.start, slice.end);

       return;
   }
CvGBTrees.java 文件源码 项目:Android-Crop-Receipt 阅读 20 收藏 0 点赞 0 评论 0
/**
* <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;
   }
CvBoost.java 文件源码 项目:Android-Crop-Receipt 阅读 18 收藏 0 点赞 0 评论 0
/**
* <p>Predicts a response for an input sample.</p>
*
* <p>The method runs the sample through the trees in the ensemble and returns the
* output class label based on the weighted voting.</p>
*
* @param sample Input sample.
* @param missing Optional mask of missing measurements. To handle missing
* measurements, the weak classifiers must include surrogate splits (see
* <code>CvDTreeParams.use_surrogates</code>).
* @param slice Continuous subset of the sequence of weak classifiers to be used
* for prediction. By default, all the weak classifiers are used.
* @param rawMode Normally, it should be set to <code>false</code>.
* @param returnSum If <code>true</code> then return sum of votes instead of the
* class label.
*
* @see <a href="http://docs.opencv.org/modules/ml/doc/boosting.html#cvboost-predict">org.opencv.ml.CvBoost.predict</a>
*/
   public  float predict(Mat sample, Mat missing, Range slice, boolean rawMode, boolean returnSum)
   {

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

       return retVal;
   }
CvBoost.java 文件源码 项目:Android-Crop-Receipt 阅读 18 收藏 0 点赞 0 评论 0
/**
* <p>Removes the specified weak classifiers.</p>
*
* <p>The method removes the specified weak classifiers from the sequence.</p>
*
* <p>Note: Do not confuse this method with the pruning of individual decision
* trees, which is currently not supported.</p>
*
* @param slice Continuous subset of the sequence of weak classifiers to be
* removed.
*
* @see <a href="http://docs.opencv.org/modules/ml/doc/boosting.html#cvboost-prune">org.opencv.ml.CvBoost.prune</a>
*/
   public  void prune(Range slice)
   {

       prune_0(nativeObj, slice.start, slice.end);

       return;
   }
CvGBTrees.java 文件源码 项目:AndroidCameraSudokuSolver 阅读 21 收藏 0 点赞 0 评论 0
/**
* <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;
   }
CvBoost.java 文件源码 项目:AndroidCameraSudokuSolver 阅读 22 收藏 0 点赞 0 评论 0
/**
* <p>Predicts a response for an input sample.</p>
*
* <p>The method runs the sample through the trees in the ensemble and returns the
* output class label based on the weighted voting.</p>
*
* @param sample Input sample.
* @param missing Optional mask of missing measurements. To handle missing
* measurements, the weak classifiers must include surrogate splits (see
* <code>CvDTreeParams.use_surrogates</code>).
* @param slice Continuous subset of the sequence of weak classifiers to be used
* for prediction. By default, all the weak classifiers are used.
* @param rawMode Normally, it should be set to <code>false</code>.
* @param returnSum If <code>true</code> then return sum of votes instead of the
* class label.
*
* @see <a href="http://docs.opencv.org/modules/ml/doc/boosting.html#cvboost-predict">org.opencv.ml.CvBoost.predict</a>
*/
   public  float predict(Mat sample, Mat missing, Range slice, boolean rawMode, boolean returnSum)
   {

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

       return retVal;
   }
CvBoost.java 文件源码 项目:AndroidCameraSudokuSolver 阅读 17 收藏 0 点赞 0 评论 0
/**
* <p>Removes the specified weak classifiers.</p>
*
* <p>The method removes the specified weak classifiers from the sequence.</p>
*
* <p>Note: Do not confuse this method with the pruning of individual decision
* trees, which is currently not supported.</p>
*
* @param slice Continuous subset of the sequence of weak classifiers to be
* removed.
*
* @see <a href="http://docs.opencv.org/modules/ml/doc/boosting.html#cvboost-prune">org.opencv.ml.CvBoost.prune</a>
*/
   public  void prune(Range slice)
   {

       prune_0(nativeObj, slice.start, slice.end);

       return;
   }
CvGBTrees.java 文件源码 项目:OpenCV_Android_Plus 阅读 19 收藏 0 点赞 0 评论 0
/**
* <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;
   }
CvBoost.java 文件源码 项目:OpenCV_Android_Plus 阅读 20 收藏 0 点赞 0 评论 0
/**
* <p>Predicts a response for an input sample.</p>
*
* <p>The method runs the sample through the trees in the ensemble and returns the
* output class label based on the weighted voting.</p>
*
* @param sample Input sample.
* @param missing Optional mask of missing measurements. To handle missing
* measurements, the weak classifiers must include surrogate splits (see
* <code>CvDTreeParams.use_surrogates</code>).
* @param slice Continuous subset of the sequence of weak classifiers to be used
* for prediction. By default, all the weak classifiers are used.
* @param rawMode Normally, it should be set to <code>false</code>.
* @param returnSum If <code>true</code> then return sum of votes instead of the
* class label.
*
* @see <a href="http://docs.opencv.org/modules/ml/doc/boosting.html#cvboost-predict">org.opencv.ml.CvBoost.predict</a>
*/
   public  float predict(Mat sample, Mat missing, Range slice, boolean rawMode, boolean returnSum)
   {

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

       return retVal;
   }
CvBoost.java 文件源码 项目:OpenCV_Android_Plus 阅读 20 收藏 0 点赞 0 评论 0
/**
* <p>Removes the specified weak classifiers.</p>
*
* <p>The method removes the specified weak classifiers from the sequence.</p>
*
* <p>Note: Do not confuse this method with the pruning of individual decision
* trees, which is currently not supported.</p>
*
* @param slice Continuous subset of the sequence of weak classifiers to be
* removed.
*
* @see <a href="http://docs.opencv.org/modules/ml/doc/boosting.html#cvboost-prune">org.opencv.ml.CvBoost.prune</a>
*/
   public  void prune(Range slice)
   {

       prune_0(nativeObj, slice.start, slice.end);

       return;
   }
CvGBTrees.java 文件源码 项目:MemeVision 阅读 21 收藏 0 点赞 0 评论 0
/**
* <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;
   }
CvBoost.java 文件源码 项目:MemeVision 阅读 20 收藏 0 点赞 0 评论 0
/**
* <p>Predicts a response for an input sample.</p>
*
* <p>The method runs the sample through the trees in the ensemble and returns the
* output class label based on the weighted voting.</p>
*
* @param sample Input sample.
* @param missing Optional mask of missing measurements. To handle missing
* measurements, the weak classifiers must include surrogate splits (see
* <code>CvDTreeParams.use_surrogates</code>).
* @param slice Continuous subset of the sequence of weak classifiers to be used
* for prediction. By default, all the weak classifiers are used.
* @param rawMode Normally, it should be set to <code>false</code>.
* @param returnSum If <code>true</code> then return sum of votes instead of the
* class label.
*
* @see <a href="http://docs.opencv.org/modules/ml/doc/boosting.html#cvboost-predict">org.opencv.ml.CvBoost.predict</a>
*/
   public  float predict(Mat sample, Mat missing, Range slice, boolean rawMode, boolean returnSum)
   {

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

       return retVal;
   }
CvBoost.java 文件源码 项目:MemeVision 阅读 20 收藏 0 点赞 0 评论 0
/**
* <p>Removes the specified weak classifiers.</p>
*
* <p>The method removes the specified weak classifiers from the sequence.</p>
*
* <p>Note: Do not confuse this method with the pruning of individual decision
* trees, which is currently not supported.</p>
*
* @param slice Continuous subset of the sequence of weak classifiers to be
* removed.
*
* @see <a href="http://docs.opencv.org/modules/ml/doc/boosting.html#cvboost-prune">org.opencv.ml.CvBoost.prune</a>
*/
   public  void prune(Range slice)
   {

       prune_0(nativeObj, slice.start, slice.end);

       return;
   }
CvGBTrees.java 文件源码 项目:RectangleDetection 阅读 16 收藏 0 点赞 0 评论 0
/**
* <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;
   }
CvBoost.java 文件源码 项目:RectangleDetection 阅读 19 收藏 0 点赞 0 评论 0
/**
* <p>Predicts a response for an input sample.</p>
*
* <p>The method runs the sample through the trees in the ensemble and returns the
* output class label based on the weighted voting.</p>
*
* @param sample Input sample.
* @param missing Optional mask of missing measurements. To handle missing
* measurements, the weak classifiers must include surrogate splits (see
* <code>CvDTreeParams.use_surrogates</code>).
* @param slice Continuous subset of the sequence of weak classifiers to be used
* for prediction. By default, all the weak classifiers are used.
* @param rawMode Normally, it should be set to <code>false</code>.
* @param returnSum If <code>true</code> then return sum of votes instead of the
* class label.
*
* @see <a href="http://docs.opencv.org/modules/ml/doc/boosting.html#cvboost-predict">org.opencv.ml.CvBoost.predict</a>
*/
   public  float predict(Mat sample, Mat missing, Range slice, boolean rawMode, boolean returnSum)
   {

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

       return retVal;
   }
CvBoost.java 文件源码 项目:RectangleDetection 阅读 17 收藏 0 点赞 0 评论 0
/**
* <p>Removes the specified weak classifiers.</p>
*
* <p>The method removes the specified weak classifiers from the sequence.</p>
*
* <p>Note: Do not confuse this method with the pruning of individual decision
* trees, which is currently not supported.</p>
*
* @param slice Continuous subset of the sequence of weak classifiers to be
* removed.
*
* @see <a href="http://docs.opencv.org/modules/ml/doc/boosting.html#cvboost-prune">org.opencv.ml.CvBoost.prune</a>
*/
   public  void prune(Range slice)
   {

       prune_0(nativeObj, slice.start, slice.end);

       return;
   }
CvGBTrees.java 文件源码 项目:cardboardAR-lib 阅读 18 收藏 0 点赞 0 评论 0
/**
* <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;
   }
CvBoost.java 文件源码 项目:cardboardAR-lib 阅读 17 收藏 0 点赞 0 评论 0
/**
* <p>Predicts a response for an input sample.</p>
*
* <p>The method runs the sample through the trees in the ensemble and returns the
* output class label based on the weighted voting.</p>
*
* @param sample Input sample.
* @param missing Optional mask of missing measurements. To handle missing
* measurements, the weak classifiers must include surrogate splits (see
* <code>CvDTreeParams.use_surrogates</code>).
* @param slice Continuous subset of the sequence of weak classifiers to be used
* for prediction. By default, all the weak classifiers are used.
* @param rawMode Normally, it should be set to <code>false</code>.
* @param returnSum If <code>true</code> then return sum of votes instead of the
* class label.
*
* @see <a href="http://docs.opencv.org/modules/ml/doc/boosting.html#cvboost-predict">org.opencv.ml.CvBoost.predict</a>
*/
   public  float predict(Mat sample, Mat missing, Range slice, boolean rawMode, boolean returnSum)
   {

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

       return retVal;
   }


问题


面经


文章

微信
公众号

扫码关注公众号