Android Open Source - android-opencv-template Stereo S G B M






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!
////  w w w  .  j a  v  a  2  s .c  o  m
package org.opencv.calib3d;

import org.opencv.core.Mat;

// C++: class StereoSGBM
/**
 * <p>Class for computing stereo correspondence using the semi-global block
 * matching algorithm.</p>
 *
 * <p>class StereoSGBM <code></p>
 *
 * <p>// C++ code:</p>
 *
 *
 * <p>StereoSGBM();</p>
 *
 * <p>StereoSGBM(int minDisparity, int numDisparities, int SADWindowSize,</p>
 *
 * <p>int P1=0, int P2=0, int disp12MaxDiff=0,</p>
 *
 * <p>int preFilterCap=0, int uniquenessRatio=0,</p>
 *
 * <p>int speckleWindowSize=0, int speckleRange=0,</p>
 *
 * <p>bool fullDP=false);</p>
 *
 * <p>virtual ~StereoSGBM();</p>
 *
 * <p>virtual void operator()(InputArray left, InputArray right, OutputArray disp);</p>
 *
 * <p>int minDisparity;</p>
 *
 * <p>int numberOfDisparities;</p>
 *
 * <p>int SADWindowSize;</p>
 *
 * <p>int preFilterCap;</p>
 *
 * <p>int uniquenessRatio;</p>
 *
 * <p>int P1, P2;</p>
 *
 * <p>int speckleWindowSize;</p>
 *
 * <p>int speckleRange;</p>
 *
 * <p>int disp12MaxDiff;</p>
 *
 * <p>bool fullDP;...</p>
 *
 * <p>};</p>
 *
 * <p>The class implements the modified H. Hirschmuller algorithm [HH08] that
 * differs from the original one as follows: </code></p>
 * <ul>
 *   <li> By default, the algorithm is single-pass, which means that you
 * consider only 5 directions instead of 8. Set <code>fullDP=true</code> to run
 * the full variant of the algorithm but beware that it may consume a lot of
 * memory.
 *   <li> The algorithm matches blocks, not individual pixels. Though, setting
 * <code>SADWindowSize=1</code> reduces the blocks to single pixels.
 *   <li> Mutual information cost function is not implemented. Instead, a
 * simpler Birchfield-Tomasi sub-pixel metric from [BT98] is used. Though, the
 * color images are supported as well.
 *   <li> Some pre- and post- processing steps from K. Konolige algorithm
 * :ocv:funcx:"StereoBM.operator()" are included, for example: pre-filtering
 * (<code>CV_STEREO_BM_XSOBEL</code> type) and post-filtering (uniqueness check,
 * quadratic interpolation and speckle filtering).
 * </ul>
 *
 * <p>Note:</p>
 * <ul>
 *   <li> (Python) An example illustrating the use of the StereoSGBM matching
 * algorithm can be found at opencv_source_code/samples/python2/stereo_match.py
 * </ul>
 *
 * @see <a href="http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html#stereosgbm">org.opencv.calib3d.StereoSGBM</a>
 */
public class StereoSGBM {

    protected final long nativeObj;
    protected StereoSGBM(long addr) { nativeObj = addr; }


    public static final int
            DISP_SHIFT = 4,
            DISP_SCALE = (1<<DISP_SHIFT);


    //
    // C++:   StereoSGBM::StereoSGBM()
    //

/**
 * <p>Initializes <code>StereoSGBM</code> and sets parameters to custom values.??</p>
 *
 * <p>The first constructor initializes <code>StereoSGBM</code> with all the
 * default parameters. So, you only have to set <code>StereoSGBM.numberOfDisparities</code>
 * at minimum. The second constructor enables you to set each parameter to a
 * custom value.</p>
 *
 * @see <a href="http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html#stereosgbm-stereosgbm">org.opencv.calib3d.StereoSGBM.StereoSGBM</a>
 */
    public   StereoSGBM()
    {

        nativeObj = StereoSGBM_0();

        return;
    }


    //
    // C++:   StereoSGBM::StereoSGBM(int minDisparity, int numDisparities, int SADWindowSize, int P1 = 0, int P2 = 0, int disp12MaxDiff = 0, int preFilterCap = 0, int uniquenessRatio = 0, int speckleWindowSize = 0, int speckleRange = 0, bool fullDP = false)
    //

/**
 * <p>Initializes <code>StereoSGBM</code> and sets parameters to custom values.??</p>
 *
 * <p>The first constructor initializes <code>StereoSGBM</code> with all the
 * default parameters. So, you only have to set <code>StereoSGBM.numberOfDisparities</code>
 * at minimum. The second constructor enables you to set each parameter to a
 * custom value.</p>
 *
 * @param minDisparity Minimum possible disparity value. Normally, it is zero
 * but sometimes rectification algorithms can shift images, so this parameter
 * needs to be adjusted accordingly.
 * @param numDisparities Maximum disparity minus minimum disparity. The value is
 * always greater than zero. In the current implementation, this parameter must
 * be divisible by 16.
 * @param SADWindowSize Matched block size. It must be an odd number
 * <code>>=1</code>. Normally, it should be somewhere in the <code>3..11</code>
 * range.
 * @param P1 The first parameter controlling the disparity smoothness. See
 * below.
 * @param P2 The second parameter controlling the disparity smoothness. The
 * larger the values are, the smoother the disparity is. <code>P1</code> is the
 * penalty on the disparity change by plus or minus 1 between neighbor pixels.
 * <code>P2</code> is the penalty on the disparity change by more than 1 between
 * neighbor pixels. The algorithm requires <code>P2 > P1</code>. See
 * <code>stereo_match.cpp</code> sample where some reasonably good
 * <code>P1</code> and <code>P2</code> values are shown (like <code>8*number_of_image_channels*SADWindowSize*SADWindowSize</code>
 * and <code>32*number_of_image_channels*SADWindowSize*SADWindowSize</code>,
 * respectively).
 * @param disp12MaxDiff Maximum allowed difference (in integer pixel units) in
 * the left-right disparity check. Set it to a non-positive value to disable the
 * check.
 * @param preFilterCap Truncation value for the prefiltered image pixels. The
 * algorithm first computes x-derivative at each pixel and clips its value by
 * <code>[-preFilterCap, preFilterCap]</code> interval. The result values are
 * passed to the Birchfield-Tomasi pixel cost function.
 * @param uniquenessRatio Margin in percentage by which the best (minimum)
 * computed cost function value should "win" the second best value to consider
 * the found match correct. Normally, a value within the 5-15 range is good
 * enough.
 * @param speckleWindowSize Maximum size of smooth disparity regions to consider
 * their noise speckles and invalidate. Set it to 0 to disable speckle
 * filtering. Otherwise, set it somewhere in the 50-200 range.
 * @param speckleRange Maximum disparity variation within each connected
 * component. If you do speckle filtering, set the parameter to a positive
 * value, it will be implicitly multiplied by 16. Normally, 1 or 2 is good
 * enough.
 * @param fullDP Set it to <code>true</code> to run the full-scale two-pass
 * dynamic programming algorithm. It will consume O(W*H*numDisparities) bytes,
 * which is large for 640x480 stereo and huge for HD-size pictures. By default,
 * it is set to <code>false</code>.
 *
 * @see <a href="http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html#stereosgbm-stereosgbm">org.opencv.calib3d.StereoSGBM.StereoSGBM</a>
 */
    public   StereoSGBM(int minDisparity, int numDisparities, int SADWindowSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio, int speckleWindowSize, int speckleRange, boolean fullDP)
    {

        nativeObj = StereoSGBM_1(minDisparity, numDisparities, SADWindowSize, P1, P2, disp12MaxDiff, preFilterCap, uniquenessRatio, speckleWindowSize, speckleRange, fullDP);

        return;
    }

/**
 * <p>Initializes <code>StereoSGBM</code> and sets parameters to custom values.??</p>
 *
 * <p>The first constructor initializes <code>StereoSGBM</code> with all the
 * default parameters. So, you only have to set <code>StereoSGBM.numberOfDisparities</code>
 * at minimum. The second constructor enables you to set each parameter to a
 * custom value.</p>
 *
 * @param minDisparity Minimum possible disparity value. Normally, it is zero
 * but sometimes rectification algorithms can shift images, so this parameter
 * needs to be adjusted accordingly.
 * @param numDisparities Maximum disparity minus minimum disparity. The value is
 * always greater than zero. In the current implementation, this parameter must
 * be divisible by 16.
 * @param SADWindowSize Matched block size. It must be an odd number
 * <code>>=1</code>. Normally, it should be somewhere in the <code>3..11</code>
 * range.
 *
 * @see <a href="http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html#stereosgbm-stereosgbm">org.opencv.calib3d.StereoSGBM.StereoSGBM</a>
 */
    public   StereoSGBM(int minDisparity, int numDisparities, int SADWindowSize)
    {

        nativeObj = StereoSGBM_2(minDisparity, numDisparities, SADWindowSize);

        return;
    }


    //
    // C++:  void StereoSGBM::operator ()(Mat left, Mat right, Mat& disp)
    //

    public  void compute(Mat left, Mat right, Mat disp)
    {

        compute_0(nativeObj, left.nativeObj, right.nativeObj, disp.nativeObj);

        return;
    }


    //
    // C++: int StereoSGBM::minDisparity
    //

    public  int get_minDisparity()
    {

        int retVal = get_minDisparity_0(nativeObj);

        return retVal;
    }


    //
    // C++: void StereoSGBM::minDisparity
    //

    public  void set_minDisparity(int minDisparity)
    {

        set_minDisparity_0(nativeObj, minDisparity);

        return;
    }


    //
    // C++: int StereoSGBM::numberOfDisparities
    //

    public  int get_numberOfDisparities()
    {

        int retVal = get_numberOfDisparities_0(nativeObj);

        return retVal;
    }


    //
    // C++: void StereoSGBM::numberOfDisparities
    //

    public  void set_numberOfDisparities(int numberOfDisparities)
    {

        set_numberOfDisparities_0(nativeObj, numberOfDisparities);

        return;
    }


    //
    // C++: int StereoSGBM::SADWindowSize
    //

    public  int get_SADWindowSize()
    {

        int retVal = get_SADWindowSize_0(nativeObj);

        return retVal;
    }


    //
    // C++: void StereoSGBM::SADWindowSize
    //

    public  void set_SADWindowSize(int SADWindowSize)
    {

        set_SADWindowSize_0(nativeObj, SADWindowSize);

        return;
    }


    //
    // C++: int StereoSGBM::preFilterCap
    //

    public  int get_preFilterCap()
    {

        int retVal = get_preFilterCap_0(nativeObj);

        return retVal;
    }


    //
    // C++: void StereoSGBM::preFilterCap
    //

    public  void set_preFilterCap(int preFilterCap)
    {

        set_preFilterCap_0(nativeObj, preFilterCap);

        return;
    }


    //
    // C++: int StereoSGBM::uniquenessRatio
    //

    public  int get_uniquenessRatio()
    {

        int retVal = get_uniquenessRatio_0(nativeObj);

        return retVal;
    }


    //
    // C++: void StereoSGBM::uniquenessRatio
    //

    public  void set_uniquenessRatio(int uniquenessRatio)
    {

        set_uniquenessRatio_0(nativeObj, uniquenessRatio);

        return;
    }


    //
    // C++: int StereoSGBM::P1
    //

    public  int get_P1()
    {

        int retVal = get_P1_0(nativeObj);

        return retVal;
    }


    //
    // C++: void StereoSGBM::P1
    //

    public  void set_P1(int P1)
    {

        set_P1_0(nativeObj, P1);

        return;
    }


    //
    // C++: int StereoSGBM::P2
    //

    public  int get_P2()
    {

        int retVal = get_P2_0(nativeObj);

        return retVal;
    }


    //
    // C++: void StereoSGBM::P2
    //

    public  void set_P2(int P2)
    {

        set_P2_0(nativeObj, P2);

        return;
    }


    //
    // C++: int StereoSGBM::speckleWindowSize
    //

    public  int get_speckleWindowSize()
    {

        int retVal = get_speckleWindowSize_0(nativeObj);

        return retVal;
    }


    //
    // C++: void StereoSGBM::speckleWindowSize
    //

    public  void set_speckleWindowSize(int speckleWindowSize)
    {

        set_speckleWindowSize_0(nativeObj, speckleWindowSize);

        return;
    }


    //
    // C++: int StereoSGBM::speckleRange
    //

    public  int get_speckleRange()
    {

        int retVal = get_speckleRange_0(nativeObj);

        return retVal;
    }


    //
    // C++: void StereoSGBM::speckleRange
    //

    public  void set_speckleRange(int speckleRange)
    {

        set_speckleRange_0(nativeObj, speckleRange);

        return;
    }


    //
    // C++: int StereoSGBM::disp12MaxDiff
    //

    public  int get_disp12MaxDiff()
    {

        int retVal = get_disp12MaxDiff_0(nativeObj);

        return retVal;
    }


    //
    // C++: void StereoSGBM::disp12MaxDiff
    //

    public  void set_disp12MaxDiff(int disp12MaxDiff)
    {

        set_disp12MaxDiff_0(nativeObj, disp12MaxDiff);

        return;
    }


    //
    // C++: bool StereoSGBM::fullDP
    //

    public  boolean get_fullDP()
    {

        boolean retVal = get_fullDP_0(nativeObj);

        return retVal;
    }


    //
    // C++: void StereoSGBM::fullDP
    //

    public  void set_fullDP(boolean fullDP)
    {

        set_fullDP_0(nativeObj, fullDP);

        return;
    }


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



    // C++:   StereoSGBM::StereoSGBM()
    private static native long StereoSGBM_0();

    // C++:   StereoSGBM::StereoSGBM(int minDisparity, int numDisparities, int SADWindowSize, int P1 = 0, int P2 = 0, int disp12MaxDiff = 0, int preFilterCap = 0, int uniquenessRatio = 0, int speckleWindowSize = 0, int speckleRange = 0, bool fullDP = false)
    private static native long StereoSGBM_1(int minDisparity, int numDisparities, int SADWindowSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio, int speckleWindowSize, int speckleRange, boolean fullDP);
    private static native long StereoSGBM_2(int minDisparity, int numDisparities, int SADWindowSize);

    // C++:  void StereoSGBM::operator ()(Mat left, Mat right, Mat& disp)
    private static native void compute_0(long nativeObj, long left_nativeObj, long right_nativeObj, long disp_nativeObj);

    // C++: int StereoSGBM::minDisparity
    private static native int get_minDisparity_0(long nativeObj);

    // C++: void StereoSGBM::minDisparity
    private static native void set_minDisparity_0(long nativeObj, int minDisparity);

    // C++: int StereoSGBM::numberOfDisparities
    private static native int get_numberOfDisparities_0(long nativeObj);

    // C++: void StereoSGBM::numberOfDisparities
    private static native void set_numberOfDisparities_0(long nativeObj, int numberOfDisparities);

    // C++: int StereoSGBM::SADWindowSize
    private static native int get_SADWindowSize_0(long nativeObj);

    // C++: void StereoSGBM::SADWindowSize
    private static native void set_SADWindowSize_0(long nativeObj, int SADWindowSize);

    // C++: int StereoSGBM::preFilterCap
    private static native int get_preFilterCap_0(long nativeObj);

    // C++: void StereoSGBM::preFilterCap
    private static native void set_preFilterCap_0(long nativeObj, int preFilterCap);

    // C++: int StereoSGBM::uniquenessRatio
    private static native int get_uniquenessRatio_0(long nativeObj);

    // C++: void StereoSGBM::uniquenessRatio
    private static native void set_uniquenessRatio_0(long nativeObj, int uniquenessRatio);

    // C++: int StereoSGBM::P1
    private static native int get_P1_0(long nativeObj);

    // C++: void StereoSGBM::P1
    private static native void set_P1_0(long nativeObj, int P1);

    // C++: int StereoSGBM::P2
    private static native int get_P2_0(long nativeObj);

    // C++: void StereoSGBM::P2
    private static native void set_P2_0(long nativeObj, int P2);

    // C++: int StereoSGBM::speckleWindowSize
    private static native int get_speckleWindowSize_0(long nativeObj);

    // C++: void StereoSGBM::speckleWindowSize
    private static native void set_speckleWindowSize_0(long nativeObj, int speckleWindowSize);

    // C++: int StereoSGBM::speckleRange
    private static native int get_speckleRange_0(long nativeObj);

    // C++: void StereoSGBM::speckleRange
    private static native void set_speckleRange_0(long nativeObj, int speckleRange);

    // C++: int StereoSGBM::disp12MaxDiff
    private static native int get_disp12MaxDiff_0(long nativeObj);

    // C++: void StereoSGBM::disp12MaxDiff
    private static native void set_disp12MaxDiff_0(long nativeObj, int disp12MaxDiff);

    // C++: bool StereoSGBM::fullDP
    private static native boolean get_fullDP_0(long nativeObj);

    // C++: void StereoSGBM::fullDP
    private static native void set_fullDP_0(long nativeObj, boolean fullDP);

    // 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