Java Code Examples for org.opencv.utils.Converters

The following examples show how to use org.opencv.utils.Converters. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: MOAAP   Source File: Calib3d.java    License: MIT License 5 votes vote down vote up
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;
}
 
Example 2
Source Project: Camdroid   Source File: Imgproc.java    License: Apache License 2.0 5 votes vote down vote up
public static void drawContours(Mat image, List<MatOfPoint> contours, int contourIdx, Scalar color, int thickness)
{
    List<Mat> contours_tmplm = new ArrayList<Mat>((contours != null) ? contours.size() : 0);
    Mat contours_mat = Converters.vector_vector_Point_to_Mat(contours, contours_tmplm);
    drawContours_1(image.nativeObj, contours_mat.nativeObj, contourIdx, color.val[0], color.val[1], color.val[2], color.val[3], thickness);
    
    return;
}
 
Example 3
Source Project: FTCVision   Source File: DescriptorMatcher.java    License: MIT License 5 votes vote down vote up
public  void knnMatch(Mat queryDescriptors, List<MatOfDMatch> matches, int k)
{
    Mat matches_mat = new Mat();
    knnMatch_3(nativeObj, queryDescriptors.nativeObj, matches_mat.nativeObj, k);
    Converters.Mat_to_vector_vector_DMatch(matches_mat, matches);
    matches_mat.release();
    return;
}
 
Example 4
Source Project: Image-Detection-Samples   Source File: Calib3d.java    License: Apache License 2.0 5 votes vote down vote up
public static float rectify3Collinear(Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Mat cameraMatrix3, Mat distCoeffs3, List<Mat> imgpt1, List<Mat> imgpt3, Size imageSize, Mat R12, Mat T12, Mat R13, Mat T13, Mat R1, Mat R2, Mat R3, Mat P1, Mat P2, Mat P3, Mat Q, double alpha, Size newImgSize, Rect roi1, Rect roi2, int flags)
{
    Mat imgpt1_mat = Converters.vector_Mat_to_Mat(imgpt1);
    Mat imgpt3_mat = Converters.vector_Mat_to_Mat(imgpt3);
    double[] roi1_out = new double[4];
    double[] roi2_out = new double[4];
    float retVal = rectify3Collinear_0(cameraMatrix1.nativeObj, distCoeffs1.nativeObj, cameraMatrix2.nativeObj, distCoeffs2.nativeObj, cameraMatrix3.nativeObj, distCoeffs3.nativeObj, imgpt1_mat.nativeObj, imgpt3_mat.nativeObj, imageSize.width, imageSize.height, R12.nativeObj, T12.nativeObj, R13.nativeObj, T13.nativeObj, R1.nativeObj, R2.nativeObj, R3.nativeObj, P1.nativeObj, P2.nativeObj, P3.nativeObj, Q.nativeObj, alpha, newImgSize.width, newImgSize.height, roi1_out, roi2_out, flags);
    if(roi1!=null){ roi1.x = (int)roi1_out[0]; roi1.y = (int)roi1_out[1]; roi1.width = (int)roi1_out[2]; roi1.height = (int)roi1_out[3]; } 
    if(roi2!=null){ roi2.x = (int)roi2_out[0]; roi2.y = (int)roi2_out[1]; roi2.width = (int)roi2_out[2]; roi2.height = (int)roi2_out[3]; } 
    return retVal;
}
 
Example 5
Source Project: AndroidDocumentScanner   Source File: Calib3d.java    License: MIT License 5 votes vote down vote up
public static double stereoCalibrateExtended(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, Mat perViewErrors, int flags, TermCriteria criteria)
{
    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 = stereoCalibrateExtended_0(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, perViewErrors.nativeObj, flags, criteria.type, criteria.maxCount, criteria.epsilon);
    
    return retVal;
}
 
Example 6
Source Project: SimpleDocumentScanner-Android   Source File: Imgcodecs.java    License: MIT License 5 votes vote down vote up
public static boolean imreadmulti(String filename, List<Mat> mats, int flags)
{
    Mat mats_mat = Converters.vector_Mat_to_Mat(mats);
    boolean retVal = imreadmulti_0(filename, mats_mat.nativeObj, flags);
    
    return retVal;
}
 
Example 7
Source Project: AndroidDocumentScanner   Source File: Video.java    License: MIT License 5 votes vote down vote up
public static int buildOpticalFlowPyramid(Mat img, List<Mat> pyramid, Size winSize, int maxLevel, boolean withDerivatives, int pyrBorder, int derivBorder, boolean tryReuseInputImage)
{
    Mat pyramid_mat = new Mat();
    int retVal = buildOpticalFlowPyramid_0(img.nativeObj, pyramid_mat.nativeObj, winSize.width, winSize.height, maxLevel, withDerivatives, pyrBorder, derivBorder, tryReuseInputImage);
    Converters.Mat_to_vector_Mat(pyramid_mat, pyramid);
    pyramid_mat.release();
    return retVal;
}
 
Example 8
Source Project: SmartPaperScan   Source File: Feature2D.java    License: Apache License 2.0 5 votes vote down vote up
public  void compute(List<Mat> images, List<MatOfKeyPoint> keypoints, List<Mat> descriptors)
{
    Mat images_mat = Converters.vector_Mat_to_Mat(images);
    List<Mat> keypoints_tmplm = new ArrayList<Mat>((keypoints != null) ? keypoints.size() : 0);
    Mat keypoints_mat = Converters.vector_vector_KeyPoint_to_Mat(keypoints, keypoints_tmplm);
    Mat descriptors_mat = new Mat();
    compute_1(nativeObj, images_mat.nativeObj, keypoints_mat.nativeObj, descriptors_mat.nativeObj);
    Converters.Mat_to_vector_vector_KeyPoint(keypoints_mat, keypoints);
    keypoints_mat.release();
    Converters.Mat_to_vector_Mat(descriptors_mat, descriptors);
    descriptors_mat.release();
    return;
}
 
Example 9
Source Project: OpenCvFaceDetect   Source File: Core.java    License: Apache License 2.0 5 votes vote down vote up
public static void vconcat(List<Mat> src, Mat dst)
{
    Mat src_mat = Converters.vector_Mat_to_Mat(src);
    vconcat_0(src_mat.nativeObj, dst.nativeObj);
    
    return;
}
 
Example 10
Source Project: OpenCvFaceDetect   Source File: Feature2D.java    License: Apache License 2.0 5 votes vote down vote up
public  void detect(List<Mat> images, List<MatOfKeyPoint> keypoints, List<Mat> masks)
{
    Mat images_mat = Converters.vector_Mat_to_Mat(images);
    Mat keypoints_mat = new Mat();
    Mat masks_mat = Converters.vector_Mat_to_Mat(masks);
    detect_2(nativeObj, images_mat.nativeObj, keypoints_mat.nativeObj, masks_mat.nativeObj);
    Converters.Mat_to_vector_vector_KeyPoint(keypoints_mat, keypoints);
    keypoints_mat.release();
    return;
}
 
Example 11
Source Project: ml-authentication   Source File: Photo.java    License: Apache License 2.0 5 votes vote down vote up
public static void denoise_TVL1(List<Mat> observations, Mat result, double lambda, int niters)
{
    Mat observations_mat = Converters.vector_Mat_to_Mat(observations);
    denoise_TVL1_0(observations_mat.nativeObj, result.nativeObj, lambda, niters);
    
    return;
}
 
Example 12
public  void match(Mat queryDescriptors, MatOfDMatch matches, List<Mat> masks)
{
    Mat matches_mat = matches;
    Mat masks_mat = Converters.vector_Mat_to_Mat(masks);
    match_2(nativeObj, queryDescriptors.nativeObj, matches_mat.nativeObj, masks_mat.nativeObj);
    
    return;
}
 
Example 13
Source Project: MOAAP   Source File: Calib3d.java    License: MIT License 5 votes vote down vote up
public static double calibrateCameraExtended(List<Mat> objectPoints, List<Mat> imagePoints, Size imageSize, Mat cameraMatrix, Mat distCoeffs, List<Mat> rvecs, List<Mat> tvecs, Mat stdDeviationsIntrinsics, Mat stdDeviationsExtrinsics, Mat perViewErrors)
{
    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 = calibrateCameraExtended_2(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, imageSize.width, imageSize.height, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvecs_mat.nativeObj, tvecs_mat.nativeObj, stdDeviationsIntrinsics.nativeObj, stdDeviationsExtrinsics.nativeObj, perViewErrors.nativeObj);
    Converters.Mat_to_vector_Mat(rvecs_mat, rvecs);
    rvecs_mat.release();
    Converters.Mat_to_vector_Mat(tvecs_mat, tvecs);
    tvecs_mat.release();
    return retVal;
}
 
Example 14
Source Project: VIA-AI   Source File: Dnn.java    License: MIT License 5 votes vote down vote up
public static Mat blobFromImages(List<Mat> images, double scalefactor)
{
    Mat images_mat = Converters.vector_Mat_to_Mat(images);
    Mat retVal = new Mat(blobFromImages_5(images_mat.nativeObj, scalefactor));
    
    return retVal;
}
 
Example 15
Source Project: MOAAP   Source File: PCTSignaturesSQFD.java    License: MIT License 5 votes vote down vote up
public  void computeQuadraticFormDistances(Mat sourceSignature, List<Mat> imageSignatures, MatOfFloat distances)
{
    Mat imageSignatures_mat = Converters.vector_Mat_to_Mat(imageSignatures);
    Mat distances_mat = distances;
    computeQuadraticFormDistances_0(nativeObj, sourceSignature.nativeObj, imageSignatures_mat.nativeObj, distances_mat.nativeObj);
    
    return;
}
 
Example 16
Source Project: OpenCvFaceDetect   Source File: Imgproc.java    License: Apache License 2.0 5 votes vote down vote up
public static void drawContours(Mat image, List<MatOfPoint> contours, int contourIdx, Scalar color, int thickness, int lineType, Mat hierarchy, int maxLevel)
{
    List<Mat> contours_tmplm = new ArrayList<Mat>((contours != null) ? contours.size() : 0);
    Mat contours_mat = Converters.vector_vector_Point_to_Mat(contours, contours_tmplm);
    drawContours_1(image.nativeObj, contours_mat.nativeObj, contourIdx, color.val[0], color.val[1], color.val[2], color.val[3], thickness, lineType, hierarchy.nativeObj, maxLevel);
    
    return;
}
 
Example 17
Source Project: marvel   Source File: Algorithm.java    License: MIT License 5 votes vote down vote up
public  void setMatVector(String name, List<Mat> value)
{
    Mat value_mat = Converters.vector_Mat_to_Mat(value);
    setMatVector_0(nativeObj, name, value_mat.nativeObj);

    return;
}
 
Example 18
Source Project: OpenCvFaceDetect   Source File: Features2d.java    License: Apache License 2.0 5 votes vote down vote up
public static void drawMatches2(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);
    drawMatches2_4(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj);
    
    return;
}
 
Example 19
Source Project: LicensePlateDiscern   Source File: Video.java    License: MIT License 5 votes vote down vote up
public static int buildOpticalFlowPyramid(Mat img, List<Mat> pyramid, Size winSize, int maxLevel, boolean withDerivatives, int pyrBorder, int derivBorder, boolean tryReuseInputImage)
{
    Mat pyramid_mat = new Mat();
    int retVal = buildOpticalFlowPyramid_0(img.nativeObj, pyramid_mat.nativeObj, winSize.width, winSize.height, maxLevel, withDerivatives, pyrBorder, derivBorder, tryReuseInputImage);
    Converters.Mat_to_vector_Mat(pyramid_mat, pyramid);
    pyramid_mat.release();
    return retVal;
}
 
Example 20
Source Project: OpenCV-AndroidSamples   Source File: MergeDebevec.java    License: MIT License 5 votes vote down vote up
public  void process(List<Mat> src, Mat dst, Mat times)
{
    Mat src_mat = Converters.vector_Mat_to_Mat(src);
    process_1(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj);
    
    return;
}
 
Example 21
public static void findContours(Mat image, List<MatOfPoint> contours, Mat hierarchy, int mode, int method)
{
    Mat contours_mat = new Mat();
    findContours_1(image.nativeObj, contours_mat.nativeObj, hierarchy.nativeObj, mode, method);
    Converters.Mat_to_vector_vector_Point(contours_mat, contours);
    contours_mat.release();
    return;
}
 
Example 22
Source Project: LicensePlateDiscern   Source File: Calib3d.java    License: MIT License 5 votes vote down vote up
public static double fisheye_stereoCalibrate(List<Mat> objectPoints, List<Mat> imagePoints1, List<Mat> imagePoints2, Mat K1, Mat D1, Mat K2, Mat D2, Size imageSize, Mat R, Mat T, 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 = fisheye_stereoCalibrate_1(objectPoints_mat.nativeObj, imagePoints1_mat.nativeObj, imagePoints2_mat.nativeObj, K1.nativeObj, D1.nativeObj, K2.nativeObj, D2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, flags);
    
    return retVal;
}
 
Example 23
Source Project: LPR   Source File: Core.java    License: Apache License 2.0 5 votes vote down vote up
public static void hconcat(List<Mat> src, Mat dst)
{
    Mat src_mat = Converters.vector_Mat_to_Mat(src);
    hconcat_0(src_mat.nativeObj, dst.nativeObj);
    
    return;
}
 
Example 24
Source Project: OpenCvFaceDetect   Source File: DescriptorMatcher.java    License: Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 25
Source Project: PixaToon   Source File: Calib3d.java    License: GNU General Public License v3.0 5 votes vote down vote up
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, TermCriteria criteria)
{
    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_0(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, criteria.type, criteria.maxCount, criteria.epsilon);
    
    return retVal;
}
 
Example 26
Source Project: MOAAP   Source File: Photo.java    License: MIT License 5 votes vote down vote up
public static void fastNlMeansDenoisingMulti(List<Mat> srcImgs, Mat dst, int imgToDenoiseIndex, int temporalWindowSize, MatOfFloat h, int templateWindowSize, int searchWindowSize, int normType)
{
    Mat srcImgs_mat = Converters.vector_Mat_to_Mat(srcImgs);
    Mat h_mat = h;
    fastNlMeansDenoisingMulti_2(srcImgs_mat.nativeObj, dst.nativeObj, imgToDenoiseIndex, temporalWindowSize, h_mat.nativeObj, templateWindowSize, searchWindowSize, normType);
    
    return;
}
 
Example 27
Source Project: FTCVision   Source File: FeatureDetector.java    License: MIT License 5 votes vote down vote up
public  void detect(List<Mat> images, List<MatOfKeyPoint> keypoints, List<Mat> masks)
{
    Mat images_mat = Converters.vector_Mat_to_Mat(images);
    Mat keypoints_mat = new Mat();
    Mat masks_mat = Converters.vector_Mat_to_Mat(masks);
    detect_2(nativeObj, images_mat.nativeObj, keypoints_mat.nativeObj, masks_mat.nativeObj);
    Converters.Mat_to_vector_vector_KeyPoint(keypoints_mat, keypoints);
    keypoints_mat.release();
    return;
}
 
Example 28
Source Project: LicensePlateDiscern   Source File: DescriptorMatcher.java    License: MIT License 5 votes vote down vote up
public  void knnMatch(Mat queryDescriptors, List<MatOfDMatch> matches, int k)
{
    Mat matches_mat = new Mat();
    knnMatch_5(nativeObj, queryDescriptors.nativeObj, matches_mat.nativeObj, k);
    Converters.Mat_to_vector_vector_DMatch(matches_mat, matches);
    matches_mat.release();
    return;
}
 
Example 29
Source Project: pasm-yolov3-Android   Source File: Calib3d.java    License: GNU General Public License v3.0 5 votes vote down vote up
public static double fisheye_stereoCalibrate(List<Mat> objectPoints, List<Mat> imagePoints1, List<Mat> imagePoints2, Mat K1, Mat D1, Mat K2, Mat D2, Size imageSize, Mat R, Mat T, 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 = fisheye_stereoCalibrate_1(objectPoints_mat.nativeObj, imagePoints1_mat.nativeObj, imagePoints2_mat.nativeObj, K1.nativeObj, D1.nativeObj, K2.nativeObj, D2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, flags);
    
    return retVal;
}
 
Example 30
Source Project: MOAAP   Source File: DescriptorExtractor.java    License: MIT License 5 votes vote down vote up
public  void compute(List<Mat> images, List<MatOfKeyPoint> keypoints, List<Mat> descriptors)
{
    Mat images_mat = Converters.vector_Mat_to_Mat(images);
    List<Mat> keypoints_tmplm = new ArrayList<Mat>((keypoints != null) ? keypoints.size() : 0);
    Mat keypoints_mat = Converters.vector_vector_KeyPoint_to_Mat(keypoints, keypoints_tmplm);
    Mat descriptors_mat = new Mat();
    compute_1(nativeObj, images_mat.nativeObj, keypoints_mat.nativeObj, descriptors_mat.nativeObj);
    Converters.Mat_to_vector_vector_KeyPoint(keypoints_mat, keypoints);
    keypoints_mat.release();
    Converters.Mat_to_vector_Mat(descriptors_mat, descriptors);
    descriptors_mat.release();
    return;
}