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

Converters.java 文件源码 项目:Image-Detection-Samples 阅读 24 收藏 0 点赞 0 评论 0
public static void Mat_to_vector_KeyPoint(Mat m, List<KeyPoint> kps) {
    if (kps == null)
        throw new java.lang.IllegalArgumentException("Output List can't be null");
    int count = m.rows();
    if (CvType.CV_64FC(7) != m.type() || m.cols() != 1)
        throw new java.lang.IllegalArgumentException(
                "CvType.CV_64FC(7) != m.type() ||  m.cols()!=1\n" + m);

    kps.clear();
    double[] buff = new double[7 * count];
    m.get(0, 0, buff);
    for (int i = 0; i < count; i++) {
        kps.add(new KeyPoint((float) buff[7 * i], (float) buff[7 * i + 1], (float) buff[7 * i + 2], (float) buff[7 * i + 3],
                (float) buff[7 * i + 4], (int) buff[7 * i + 5], (int) buff[7 * i + 6]));
    }
}
Calib3d.java 文件源码 项目:MOAAP 阅读 30 收藏 0 点赞 0 评论 0
public static Mat findHomography(MatOfPoint2f srcPoints, MatOfPoint2f dstPoints, int method, double ransacReprojThreshold, Mat mask, int maxIters, double confidence)
{
    Mat srcPoints_mat = srcPoints;
    Mat dstPoints_mat = dstPoints;
    Mat retVal = new Mat(findHomography_0(srcPoints_mat.nativeObj, dstPoints_mat.nativeObj, method, ransacReprojThreshold, mask.nativeObj, maxIters, confidence));

    return retVal;
}
Features2d.java 文件源码 项目:EyeShopping 阅读 21 收藏 0 点赞 0 评论 0
public static void drawMatchesKnn(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, List<MatOfDMatch> matches1to2, Mat outImg)
{
    Mat keypoints1_mat = keypoints1;
    Mat keypoints2_mat = keypoints2;
    List<Mat> matches1to2_tmplm = new ArrayList<Mat>((matches1to2 != null) ? matches1to2.size() : 0);
    Mat matches1to2_mat = Converters.vector_vector_DMatch_to_Mat(matches1to2, matches1to2_tmplm);
    drawMatchesKnn_1(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj);

    return;
}
Imgcodecs.java 文件源码 项目:MOAAP 阅读 28 收藏 0 点赞 0 评论 0
public static boolean imencode(String ext, Mat img, MatOfByte buf)
{
    Mat buf_mat = buf;
    boolean retVal = imencode_1(ext, img.nativeObj, buf_mat.nativeObj);

    return retVal;
}
Feature2D.java 文件源码 项目:react-native-scan-doc 阅读 25 收藏 0 点赞 0 评论 0
public  void detectAndCompute(Mat image, Mat mask, MatOfKeyPoint keypoints, Mat descriptors)
{
    Mat keypoints_mat = keypoints;
    detectAndCompute_1(nativeObj, image.nativeObj, mask.nativeObj, keypoints_mat.nativeObj, descriptors.nativeObj);

    return;
}
Photo.java 文件源码 项目:MOAAP 阅读 25 收藏 0 点赞 0 评论 0
public static void fastNlMeansDenoisingMulti(List<Mat> srcImgs, Mat dst, int imgToDenoiseIndex, int temporalWindowSize, float h, int templateWindowSize, int searchWindowSize)
{
    Mat srcImgs_mat = Converters.vector_Mat_to_Mat(srcImgs);
    fastNlMeansDenoisingMulti_0(srcImgs_mat.nativeObj, dst.nativeObj, imgToDenoiseIndex, temporalWindowSize, h, templateWindowSize, searchWindowSize);

    return;
}
BOWImgDescriptorExtractor.java 文件源码 项目:Microsphere 阅读 31 收藏 0 点赞 0 评论 0
public  void compute(Mat image, MatOfKeyPoint keypoints, Mat imgDescriptor)
{
    Mat keypoints_mat = keypoints;
    compute_0(nativeObj, image.nativeObj, keypoints_mat.nativeObj, imgDescriptor.nativeObj);

    return;
}
FeatureDetector.java 文件源码 项目:MOAAP 阅读 22 收藏 0 点赞 0 评论 0
public  void detect(Mat image, MatOfKeyPoint keypoints, Mat mask)
{
    Mat keypoints_mat = keypoints;
    detect_0(nativeObj, image.nativeObj, keypoints_mat.nativeObj, mask.nativeObj);

    return;
}
Features2d.java 文件源码 项目:Team9261-2017-2018 阅读 28 收藏 0 点赞 0 评论 0
public static void drawMatchesKnn(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, List<MatOfDMatch> matches1to2, Mat outImg, Scalar matchColor, Scalar singlePointColor, List<MatOfByte> matchesMask, int flags)
{
    Mat keypoints1_mat = keypoints1;
    Mat keypoints2_mat = keypoints2;
    List<Mat> matches1to2_tmplm = new ArrayList<Mat>((matches1to2 != null) ? matches1to2.size() : 0);
    Mat matches1to2_mat = Converters.vector_vector_DMatch_to_Mat(matches1to2, matches1to2_tmplm);
    List<Mat> matchesMask_tmplm = new ArrayList<Mat>((matchesMask != null) ? matchesMask.size() : 0);
    Mat matchesMask_mat = Converters.vector_vector_char_to_Mat(matchesMask, matchesMask_tmplm);
    drawMatchesKnn_0(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj, matchColor.val[0], matchColor.val[1], matchColor.val[2], matchColor.val[3], singlePointColor.val[0], singlePointColor.val[1], singlePointColor.val[2], singlePointColor.val[3], matchesMask_mat.nativeObj, flags);

    return;
}
Calib3d.java 文件源码 项目:MOAAP 阅读 23 收藏 0 点赞 0 评论 0
public static boolean solvePnPRansac(MatOfPoint3f objectPoints, MatOfPoint2f imagePoints, Mat cameraMatrix, MatOfDouble distCoeffs, Mat rvec, Mat tvec, boolean useExtrinsicGuess, int iterationsCount, float reprojectionError, double confidence, Mat inliers, int flags)
{
    Mat objectPoints_mat = objectPoints;
    Mat imagePoints_mat = imagePoints;
    Mat distCoeffs_mat = distCoeffs;
    boolean retVal = solvePnPRansac_0(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, cameraMatrix.nativeObj, distCoeffs_mat.nativeObj, rvec.nativeObj, tvec.nativeObj, useExtrinsicGuess, iterationsCount, reprojectionError, confidence, inliers.nativeObj, flags);

    return retVal;
}
DescriptorMatcher.java 文件源码 项目:react-native-scan-doc 阅读 22 收藏 0 点赞 0 评论 0
public  void match(Mat queryDescriptors, MatOfDMatch matches)
{
    Mat matches_mat = matches;
    match_3(nativeObj, queryDescriptors.nativeObj, matches_mat.nativeObj);

    return;
}
Imgproc.java 文件源码 项目:DNNLibrary 阅读 57 收藏 0 点赞 0 评论 0
public static void polylines(Mat img, List<MatOfPoint> pts, boolean isClosed, Scalar color, int thickness)
{
    List<Mat> pts_tmplm = new ArrayList<Mat>((pts != null) ? pts.size() : 0);
    Mat pts_mat = Converters.vector_vector_Point_to_Mat(pts, pts_tmplm);
    polylines_1(img.nativeObj, pts_mat.nativeObj, isClosed, color.val[0], color.val[1], color.val[2], color.val[3], thickness);

    return;
}
Imgproc.java 文件源码 项目:EyeShopping 阅读 25 收藏 0 点赞 0 评论 0
public static void cornerSubPix(Mat image, MatOfPoint2f corners, Size winSize, Size zeroZone, TermCriteria criteria)
{
    Mat corners_mat = corners;
    cornerSubPix_0(image.nativeObj, corners_mat.nativeObj, winSize.width, winSize.height, zeroZone.width, zeroZone.height, criteria.type, criteria.maxCount, criteria.epsilon);

    return;
}
HOGDescriptor.java 文件源码 项目:TinyPlanetMaker 阅读 22 收藏 0 点赞 0 评论 0
public  void detect(Mat img, MatOfPoint foundLocations, MatOfDouble weights)
{
    Mat foundLocations_mat = foundLocations;
    Mat weights_mat = weights;
    detect_1(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, weights_mat.nativeObj);

    return;
}
Imgproc.java 文件源码 项目:FTC2016 阅读 20 收藏 0 点赞 0 评论 0
public static Point phaseCorrelate(Mat src1, Mat src2, Mat window, double[] response)
{
    double[] response_out = new double[1];
    Point retVal = new Point(phaseCorrelate_0(src1.nativeObj, src2.nativeObj, window.nativeObj, response_out));
    if(response!=null) response[0] = (double)response_out[0];
    return retVal;
}
Calib3d.java 文件源码 项目:DogeCV 阅读 26 收藏 0 点赞 0 评论 0
public static double calibrateCamera(List<Mat> objectPoints, List<Mat> imagePoints, Size imageSize, Mat cameraMatrix, Mat distCoeffs, List<Mat> rvecs, List<Mat> tvecs, int flags, TermCriteria criteria)
{
    Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
    Mat imagePoints_mat = Converters.vector_Mat_to_Mat(imagePoints);
    Mat rvecs_mat = new Mat();
    Mat tvecs_mat = new Mat();
    double retVal = calibrateCamera_0(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, imageSize.width, imageSize.height, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvecs_mat.nativeObj, tvecs_mat.nativeObj, flags, criteria.type, criteria.maxCount, criteria.epsilon);
    Converters.Mat_to_vector_Mat(rvecs_mat, rvecs);
    rvecs_mat.release();
    Converters.Mat_to_vector_Mat(tvecs_mat, tvecs);
    tvecs_mat.release();
    return retVal;
}
Calib3d.java 文件源码 项目:mao-android 阅读 29 收藏 0 点赞 0 评论 0
public static double stereoCalibrate(List<Mat> objectPoints, List<Mat> imagePoints1, List<Mat> imagePoints2, Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat E, Mat F, int flags)
{
    Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
    Mat imagePoints1_mat = Converters.vector_Mat_to_Mat(imagePoints1);
    Mat imagePoints2_mat = Converters.vector_Mat_to_Mat(imagePoints2);
    double retVal = stereoCalibrate_1(objectPoints_mat.nativeObj, imagePoints1_mat.nativeObj, imagePoints2_mat.nativeObj, cameraMatrix1.nativeObj, distCoeffs1.nativeObj, cameraMatrix2.nativeObj, distCoeffs2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, E.nativeObj, F.nativeObj, flags);

    return retVal;
}
AlignMTB.java 文件源码 项目:android-imaging-utils 阅读 29 收藏 0 点赞 0 评论 0
public  void process(List<Mat> src, List<Mat> dst, Mat times, Mat response)
{
    Mat src_mat = Converters.vector_Mat_to_Mat(src);
    Mat dst_mat = Converters.vector_Mat_to_Mat(dst);
    process_0(nativeObj, src_mat.nativeObj, dst_mat.nativeObj, times.nativeObj, response.nativeObj);

    return;
}
Imgcodecs.java 文件源码 项目:Checkerboard-IMU-Comparator 阅读 156 收藏 0 点赞 0 评论 0
public static boolean imwrite(String filename, Mat img, MatOfInt params)
{
    Mat params_mat = params;
    boolean retVal = imwrite_0(filename, img.nativeObj, params_mat.nativeObj);

    return retVal;
}
Imgproc.java 文件源码 项目:fingerblox 阅读 24 收藏 0 点赞 0 评论 0
public static void cornerSubPix(Mat image, MatOfPoint2f corners, Size winSize, Size zeroZone, TermCriteria criteria)
{
    Mat corners_mat = corners;
    cornerSubPix_0(image.nativeObj, corners_mat.nativeObj, winSize.width, winSize.height, zeroZone.width, zeroZone.height, criteria.type, criteria.maxCount, criteria.epsilon);

    return;
}
Imgproc.java 文件源码 项目:FTC2016 阅读 19 收藏 0 点赞 0 评论 0
public static void undistortPoints(MatOfPoint2f src, MatOfPoint2f dst, Mat cameraMatrix, Mat distCoeffs)
{
    Mat src_mat = src;
    Mat dst_mat = dst;
    undistortPoints_1(src_mat.nativeObj, dst_mat.nativeObj, cameraMatrix.nativeObj, distCoeffs.nativeObj);

    return;
}
Core.java 文件源码 项目:Android-Code-Demos 阅读 22 收藏 0 点赞 0 评论 0
public static void mixChannels(List<Mat> src, List<Mat> dst, MatOfInt fromTo)
{
    Mat src_mat = Converters.vector_Mat_to_Mat(src);
    Mat dst_mat = Converters.vector_Mat_to_Mat(dst);
    Mat fromTo_mat = fromTo;
    mixChannels_0(src_mat.nativeObj, dst_mat.nativeObj, fromTo_mat.nativeObj);

    return;
}
DescriptorMatcher.java 文件源码 项目:MOAAP 阅读 25 收藏 0 点赞 0 评论 0
public  void radiusMatch(Mat queryDescriptors, Mat trainDescriptors, List<MatOfDMatch> matches, float maxDistance, Mat mask, boolean compactResult)
{
    Mat matches_mat = new Mat();
    radiusMatch_0(nativeObj, queryDescriptors.nativeObj, trainDescriptors.nativeObj, matches_mat.nativeObj, maxDistance, mask.nativeObj, compactResult);
    Converters.Mat_to_vector_vector_DMatch(matches_mat, matches);
    matches_mat.release();
    return;
}
Converters.java 文件源码 项目:MOAAP 阅读 25 收藏 0 点赞 0 评论 0
public static void Mat_to_vector_DMatch(Mat m, List<DMatch> matches) {
    if (matches == null)
        throw new java.lang.IllegalArgumentException("Output List can't be null");
    int count = m.rows();
    if (CvType.CV_64FC4 != m.type() || m.cols() != 1)
        throw new java.lang.IllegalArgumentException(
                "CvType.CV_64FC4 != m.type() ||  m.cols()!=1\n" + m);

    matches.clear();
    double[] buff = new double[4 * count];
    m.get(0, 0, buff);
    for (int i = 0; i < count; i++) {
        matches.add(new DMatch((int) buff[4 * i], (int) buff[4 * i + 1], (int) buff[4 * i + 2], (float) buff[4 * i + 3]));
    }
}
Features2d.java 文件源码 项目:MOAAP 阅读 24 收藏 0 点赞 0 评论 0
public static void drawKeypoints(Mat image, MatOfKeyPoint keypoints, Mat outImage, Scalar color, int flags)
{
    Mat keypoints_mat = keypoints;
    drawKeypoints_0(image.nativeObj, keypoints_mat.nativeObj, outImage.nativeObj, color.val[0], color.val[1], color.val[2], color.val[3], flags);

    return;
}
Calib3d.java 文件源码 项目:DNNLibrary 阅读 23 收藏 0 点赞 0 评论 0
public static void projectPoints(MatOfPoint3f objectPoints, MatOfPoint2f imagePoints, Mat rvec, Mat tvec, Mat K, Mat D)
{
    Mat objectPoints_mat = objectPoints;
    Mat imagePoints_mat = imagePoints;
    projectPoints_3(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, rvec.nativeObj, tvec.nativeObj, K.nativeObj, D.nativeObj);

    return;
}
Rotacao.java 文件源码 项目:cc-unespar 阅读 24 收藏 0 点赞 0 评论 0
public Rotacao (Mat imagem){
    this.original = imagem;
}
Converters.java 文件源码 项目:android-age-estimator 阅读 26 收藏 0 点赞 0 评论 0
public static Mat vector_Point3f_to_Mat(List<Point3> pts) {
    return vector_Point3_to_Mat(pts, CvType.CV_32F);
}
Converters.java 文件源码 项目:OpenCV 阅读 26 收藏 0 点赞 0 评论 0
public static Mat vector_Point3d_to_Mat(List<Point3> pts) {
    return vector_Point3_to_Mat(pts, CvType.CV_64F);
}
CameraBridgeViewBase.java 文件源码 项目:react-native-scan-doc 阅读 39 收藏 0 点赞 0 评论 0
/**
 * This method shall be called by the subclasses when they have valid
 * object and want it to be delivered to external client (via callback) and
 * then displayed on the screen.
 * @param frame - the current frame to be delivered
 */
protected void deliverAndDrawFrame(CvCameraViewFrame frame) {
    Mat modified;

    if (mListener != null) {
        modified = mListener.onCameraFrame(frame);
    } else {
        modified = frame.rgba();
    }

    boolean bmpValid = true;
    if (modified != null) {
        try {
            Utils.matToBitmap(modified, mCacheBitmap);
        } catch(Exception e) {
            Log.e(TAG, "Mat type: " + modified);
            Log.e(TAG, "Bitmap type: " + mCacheBitmap.getWidth() + "*" + mCacheBitmap.getHeight());
            Log.e(TAG, "Utils.matToBitmap() throws an exception: " + e.getMessage());
            bmpValid = false;
        }
    }

    if (bmpValid && mCacheBitmap != null) {
        Canvas canvas = getHolder().lockCanvas();
        if (canvas != null) {
            canvas.drawColor(0, android.graphics.PorterDuff.Mode.CLEAR);
            if (BuildConfig.DEBUG)
                Log.d(TAG, "mStretch value: " + mScale);

            if (mScale != 0) {
                canvas.drawBitmap(mCacheBitmap, new Rect(0,0,mCacheBitmap.getWidth(), mCacheBitmap.getHeight()),
                     new Rect((int)((canvas.getWidth() - mScale*mCacheBitmap.getWidth()) / 2),
                     (int)((canvas.getHeight() - mScale*mCacheBitmap.getHeight()) / 2),
                     (int)((canvas.getWidth() - mScale*mCacheBitmap.getWidth()) / 2 + mScale*mCacheBitmap.getWidth()),
                     (int)((canvas.getHeight() - mScale*mCacheBitmap.getHeight()) / 2 + mScale*mCacheBitmap.getHeight())), null);
            } else {
                 canvas.drawBitmap(mCacheBitmap, new Rect(0,0,mCacheBitmap.getWidth(), mCacheBitmap.getHeight()),
                     new Rect((canvas.getWidth() - mCacheBitmap.getWidth()) / 2,
                     (canvas.getHeight() - mCacheBitmap.getHeight()) / 2,
                     (canvas.getWidth() - mCacheBitmap.getWidth()) / 2 + mCacheBitmap.getWidth(),
                     (canvas.getHeight() - mCacheBitmap.getHeight()) / 2 + mCacheBitmap.getHeight()), null);
            }

            if (mFpsMeter != null) {
                mFpsMeter.measure();
                mFpsMeter.draw(canvas, 20, 30);
            }
            getHolder().unlockCanvasAndPost(canvas);
        }
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号