anonymous No title
No License Java
2020年09月13日
Copy Clone
private double[][] estimatePose(List<Mat> corners){
        float marker_length = (float) 0.05;//0.05
        double camera_matrix[] = {344.173397, 0.000000, 630.793795,
                0.000000, 344.277922, 487.033834,
                0.000000, 0.000000, 1.000000};
        double distortion_coefficients[] = {-0.152963, 0.017530, -0.001107,
                -0.000210, 0.000000};
        Mat camera_matrix_mat = new Mat(3,3,CV_64F);
        Mat distortion_coefficients_mat = new Mat(1,5,CV_64F);
        camera_matrix_mat.put(0,0,camera_matrix[0]);
        camera_matrix_mat.put(0,1,camera_matrix[1]);
        camera_matrix_mat.put(0,2,camera_matrix[2]);
        camera_matrix_mat.put(1,0,camera_matrix[3]);
        camera_matrix_mat.put(1,1,camera_matrix[4]);
        camera_matrix_mat.put(1,2,camera_matrix[5]);
        camera_matrix_mat.put(2,0,camera_matrix[6]);
        camera_matrix_mat.put(2,1,camera_matrix[7]);
        camera_matrix_mat.put(2,2,camera_matrix[8]);
        distortion_coefficients_mat.put(0,0,distortion_coefficients[0]);
        distortion_coefficients_mat.put(0,1,distortion_coefficients[1]);
        distortion_coefficients_mat.put(0,2,distortion_coefficients[2]);
        distortion_coefficients_mat.put(0,3,distortion_coefficients[3]);
        distortion_coefficients_mat.put(0,4,distortion_coefficients[4]);
        Mat rvecs = new Mat();
        Mat tvecs = new Mat();
        Aruco.estimatePoseSingleMarkers(corners,marker_length,camera_matrix_mat,distortion_coefficients_mat,rvecs,tvecs);
        Log.d("MY_STRING", "rvecs[0,0] =" + Arrays.toString(rvecs.get(0, 0)));
        Log.d("MY_STRING", "tvecs[0,0] = "+ Arrays.toString(tvecs.get(0, 0)));
        double[][] ans = new double[2][];
        ans[0] = rvecs.get(0,0);
        ans[1] = tvecs.get(0,0);
        return ans;
    }
    private boolean readARmarker(Bitmap bitmap, boolean needSend) {
        int width = bitmap.getWidth();
        int height = bitmap.getHeight();
        bitmap = Bitmap.createScaledBitmap(bitmap,(int)(width*0.3),(int)(height*0.3),true);
        Mat inputImage = new Mat();
        bitmapToMat(bitmap,inputImage,false);
        Dictionary dictionary = Aruco.getPredefinedDictionary(Aruco.DICT_5X5_250);
        List<Mat> corners = new ArrayList<>();
        Mat markerIds = new Mat();
        DetectorParameters parameters = DetectorParameters.create();
        Imgproc.cvtColor(inputImage, inputImage, Imgproc.COLOR_BGR2GRAY);
        Aruco.detectMarkers(inputImage, dictionary, corners, markerIds, parameters);
        String markerIDfromArr = Arrays.toString(markerIds.get(0, 0));
        if (markerIDfromArr.equals("null")) {
            return false;
        } else {
            String markerID = String.valueOf((int)(markerIds.get(0, 0)[0]));
            double[][] vecs = estimatePose(corners);
            //vecs[][]はrvecとtvecが入った二次元配列です。以下にそれぞれの要素を示します。
            Log.d("MY_STRING", "rvec_1 = " +vecs[0][0]);
            Log.d("MY_STRING", "rvec_2 = " +vecs[0][1]);
            Log.d("MY_STRING", "rvec_3 = " +vecs[0][2]);
            Log.d("MY_STRING", "tvec_1 = " +vecs[1][0]);
            Log.d("MY_STRING", "tvec_2 = " +vecs[1][1]);
            Log.d("MY_STRING", "tvec_3 = " +vecs[1][2]);

            if(needSend){
                api.judgeSendDiscoveredAR(markerID);
            }
            return true;
        }
    }
private double[][] estimatePose(List<Mat> corners){
        float marker_length = (float) 0.05;//0.05
        double camera_matrix[] = {344.173397, 0.000000, 630.793795,
                0.000000, 344.277922, 487.033834,
                0.000000, 0.000000, 1.000000};
        double distortion_coefficients[] = {-0.152963, 0.017530, -0.001107,
                -0.000210, 0.000000};
        Mat camera_matrix_mat = new Mat(3,3,CV_64F);
        Mat distortion_coefficients_mat = new Mat(1,5,CV_64F);
        camera_matrix_mat.put(0,0,camera_matrix[0]);
        camera_matrix_mat.put(0,1,camera_matrix[1]);
        camera_matrix_mat.put(0,2,camera_matrix[2]);
        camera_matrix_mat.put(1,0,camera_matrix[3]);
        camera_matrix_mat.put(1,1,camera_matrix[4]);
        camera_matrix_mat.put(1,2,camera_matrix[5]);
        camera_matrix_mat.put(2,0,camera_matrix[6]);
        camera_matrix_mat.put(2,1,camera_matrix[7]);
        camera_matrix_mat.put(2,2,camera_matrix[8]);
        distortion_coefficients_mat.put(0,0,distortion_coefficients[0]);
        distortion_coefficients_mat.put(0,1,distortion_coefficients[1]);
        distortion_coefficients_mat.put(0,2,distortion_coefficients[2]);
        distortion_coefficients_mat.put(0,3,distortion_coefficients[3]);
        distortion_coefficients_mat.put(0,4,distortion_coefficients[4]);
        Mat rvecs = new Mat();
        Mat tvecs = new Mat();
        Aruco.estimatePoseSingleMarkers(corners,marker_length,camera_matrix_mat,distortion_coefficients_mat,rvecs,tvecs);
        Log.d("MY_STRING", "rvecs[0,0] =" + Arrays.toString(rvecs.get(0, 0)));
        Log.d("MY_STRING", "tvecs[0,0] = "+ Arrays.toString(tvecs.get(0, 0)));
        double[][] ans = new double[2][];
        ans[0] = rvecs.get(0,0);
        ans[1] = tvecs.get(0,0);
        return ans;
    }
    private boolean readARmarker(Bitmap bitmap, boolean needSend) {
        int width = bitmap.getWidth();
        int height = bitmap.getHeight();
        bitmap = Bitmap.createScaledBitmap(bitmap,(int)(width*0.3),(int)(height*0.3),true);
        Mat inputImage = new Mat();
        bitmapToMat(bitmap,inputImage,false);
        Dictionary dictionary = Aruco.getPredefinedDictionary(Aruco.DICT_5X5_250);
        List<Mat> corners = new ArrayList<>();
        Mat markerIds = new Mat();
        DetectorParameters parameters = DetectorParameters.create();
        Imgproc.cvtColor(inputImage, inputImage, Imgproc.COLOR_BGR2GRAY);
        Aruco.detectMarkers(inputImage, dictionary, corners, markerIds, parameters);
        String markerIDfromArr = Arrays.toString(markerIds.get(0, 0));
        if (markerIDfromArr.equals("null")) {
            return false;
        } else {
            String markerID = String.valueOf((int)(markerIds.get(0, 0)[0]));
            double[][] vecs = estimatePose(corners);
            //vecs[][]はrvecとtvecが入った二次元配列です。以下にそれぞれの要素を示します。
            Log.d("MY_STRING", "rvec_1 = " +vecs[0][0]);
            Log.d("MY_STRING", "rvec_2 = " +vecs[0][1]);
            Log.d("MY_STRING", "rvec_3 = " +vecs[0][2]);
            Log.d("MY_STRING", "tvec_1 = " +vecs[1][0]);
            Log.d("MY_STRING", "tvec_2 = " +vecs[1][1]);
            Log.d("MY_STRING", "tvec_3 = " +vecs[1][2]);

            if(needSend){
                api.judgeSendDiscoveredAR(markerID);
            }
            return true;
        }
    }
anonymous
Anonymous
2021年04月23日
Pills information leaflet. Long-Term Effects. <a href="https://toplyrica.top">where can i buy pregabalin for sale</a> in Canada Everything trends of meds. Read now.
anonymous
Anonymous
2021年04月28日
Drug information sheet. What side effects? <a href="https://pregabalin24x7.top">can i purchase pregabalin pills</a> in US Some trends of drug. Get now.
anonymous
Anonymous
2021年04月30日
how long before sex should i take cialis <a href="https://mycialistabs.com/">free trial cialis</a> cialis manufacturer coupon 2018
anonymous
Anonymous
2021年04月30日
teva generic cialis <a href="https://mycialistabs.com/">cialis alternative over the counter</a> when does cialis go generic
anonymous
Anonymous
2021年05月01日
cialis blood pressure <a href="https://toptadalafiltabs.com/">how long does it take cialis to work</a> cialis 5mg price cvs
anonymous
Anonymous
2021年05月01日
cialis 20 milligram <a href="https://toptadalafiltabs.com/">how long does it take for cialis to work</a> cialis back pain
anonymous
Anonymous
2021年05月04日
how to write a quote in an essay <a href="https://topessaywriterfas.com/">site</a> how to write a narrative interview essay
anonymous
Anonymous
2021年05月04日
how to write a 5 paragraph essay pdf <a href="https://topessaywriterfas.com/">hire essay writer</a> write college essay for me
anonymous
Anonymous
2021年05月06日
essay on indian police service <a href="http://writemyessayslfd.com/">writing expository essays</a> writing a critique essay
anonymous
Anonymous
2021年05月06日
shared service center essay <a href="http://writemyessayslfd.com/">here</a> archaeology essay writing service
anonymous
Anonymous
2021年05月06日
online viagra <a href="https://mrviagrashop.com">https://mrviagrashop.com</a> over the counter viagra substitute walgreens
anonymous
Anonymous
2021年05月06日
taking viagra for fun <a href="https://mrviagrashop.com">viagra otc</a> 200 mg sildenafil citrate
anonymous
Anonymous
2021年05月07日
sildenafil price cvs <a href="https://mysildenafilkr.com/">generic viagra names</a> 100mg sildenafil
anonymous
Anonymous
2021年05月07日
viagra without a doctor prescription canada <a href="https://mysildenafilkr.com/">cost of viagra</a> sildenafil online usa
anonymous
Anonymous
2021年05月11日
cialis from canada <a href="http://tadalafilled.com/">cialis side effects</a> cialis from india
anonymous
Anonymous
2021年05月11日
cialis daily cost <a href="http://tadalafilled.com/">where to buy cialis</a> cialis cost per pill
anonymous
Anonymous
2021年05月11日
action verbs resume <a href="http://coverletterforresumetop.com/">writing a professional resume</a> resume google docs
anonymous
Anonymous
2021年05月11日
professional resumes <a href="http://coverletterforresumetop.com/">find a resume writer</a> social worker resume
anonymous
Anonymous
2021年05月12日
management resume <a href="https://writingacoverletteronline.com/">federal resume writers</a> scrum master resume
anonymous
Anonymous
2021年05月12日
warehouse resume <a href="https://writingacoverletteronline.com/">work experience resume</a> cv versus resume
anonymous
Anonymous
2021年05月13日
women viagra <a href="https://edviagramaster.net/">viagra pranks</a> online pharmacy ezzz viagra
anonymous
Anonymous
2021年05月13日
cheap generic viagra <a href="https://edviagramaster.net/">sildenafil generic price</a> viagra canada prescription
anonymous
Anonymous
2021年05月15日
mail order viagra <a href="https://sildenafilviagratop.com">sildenafil 20 mg tablet</a> viagra canada
anonymous
Anonymous
2021年05月15日
sildenafil 100 mg tablet <a href="https://sildenafilviagratop.com">viagra for sale</a> instant natural viagra
anonymous
Anonymous
2021年05月15日
buy cialis online overnight shipping <a href="https://cialisortadalafil.com/">viagra vs cialis vs levitra</a> order cialis
anonymous
Anonymous
2021年05月15日
cialis expiration <a href="https://cialisortadalafil.com/">cialis review</a> is cialis over the counter
anonymous
Anonymous
2021年05月16日
buy cialis online cheap <a href="https://topcialistabs.com/">cialis from canada</a> how long does cialis last?
anonymous
Anonymous
2021年05月16日
cialis sample <a href="https://topcialistabs.com/">viagra and cialis</a> cialis 5mg side effects
anonymous
Anonymous
2021年05月18日
Medicament information sheet. Long-Term Effects. <a href="https://zantac4u.top">cheap zantac tablets</a> in the USA All about medicament. Get here.
anonymous
Anonymous
2021年05月18日
Drugs prescribing information. What side effects? <a href="https://smotrite-online-films.ru">where to get cheap valtrex</a> in US Some news about drug. Get information here.
anonymous
Anonymous
2021年05月21日
<a href="https://5bz.ru/">предприятия россии база данных</a>
anonymous
Anonymous
2021年05月21日
<a href="https://5bz.ru/">базы предприятий россии бесплатно</a>
anonymous
Anonymous
2021年06月02日
Medicines information. What side effects can this medication cause? <a href="https://diltiazem4u.top">can i get generic diltiazem</a> in USA Everything trends of medicament. Get here.