예제 #1
0
파일: Highgui.cs 프로젝트: chrissav/thesis
        //
        // C++:  bool imencode(string ext, Mat img, vector_uchar& buf, vector_int params = vector<int>())
        //

        /**
         * <p>Encodes an image into a memory buffer.</p>
         *
         * <p>The function compresses the image and stores it in the memory buffer that is
         * resized to fit the result.
         * See "imwrite" for the list of supported formats and flags description.</p>
         *
         * <p>Note: <code>cvEncodeImage</code> returns single-row matrix of type
         * <code>CV_8UC1</code> that contains encoded image as array of bytes.</p>
         *
         * @param ext File extension that defines the output format.
         * @param img Image to be written.
         * @param buf Output buffer resized to fit the compressed image.
         * @param params Format-specific parameters. See "imwrite".
         *
         * @see <a href="http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html#imencode">org.opencv.highgui.Highgui.imencode</a>
         */
        public static bool imencode(string ext, Mat img, MatOfByte buf, MatOfInt _params)
        {
            if (img != null)
            {
                img.ThrowIfDisposed();
            }
            if (buf != null)
            {
                buf.ThrowIfDisposed();
            }
            if (_params != null)
            {
                _params.ThrowIfDisposed();
            }

                                                #if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR) || UNITY_5
            Mat  buf_mat    = buf;
            Mat  params_mat = _params;
            bool retVal     = highgui_Highgui_imencode_10(ext, img.nativeObj, buf_mat.nativeObj, params_mat.nativeObj);

            return(retVal);
                                                #else
            return(false);
                                                #endif
        }
예제 #2
0
파일: Dnn.cs 프로젝트: jasonta/Portalble
        //javadoc: readNetFromTensorflow(bufferModel)
        public static Net readNetFromTensorflow(MatOfByte bufferModel)
        {
            if (bufferModel != null)
            {
                bufferModel.ThrowIfDisposed();
            }
#if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat bufferModel_mat = bufferModel;
            Net retVal          = new Net(dnn_Dnn_readNetFromTensorflow_13(bufferModel_mat.nativeObj));

            return(retVal);
#else
            return(null);
#endif
        }
예제 #3
0
        //javadoc: imencode(ext, img, buf)
        public static bool imencode(string ext, Mat img, MatOfByte buf)
        {
            if (img != null)
            {
                img.ThrowIfDisposed();
            }
            if (buf != null)
            {
                buf.ThrowIfDisposed();
            }
#if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat  buf_mat = buf;
            bool retVal  = imgcodecs_Imgcodecs_imencode_11(ext, img.nativeObj, buf_mat.nativeObj);

            return(retVal);
#else
            return(false);
#endif
        }
예제 #4
0
        //
        // C++:  void drawMatches(Mat img1, vector_KeyPoint keypoints1, Mat img2, vector_KeyPoint keypoints2, vector_DMatch matches1to2, Mat outImg, Scalar matchColor = Scalar::all(-1), Scalar singlePointColor = Scalar::all(-1), vector_char matchesMask = std::vector<char>(), int flags = 0)
        //

        //javadoc: drawMatches(img1, keypoints1, img2, keypoints2, matches1to2, outImg, matchColor, singlePointColor, matchesMask, flags)
        public static void drawMatches(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, MatOfDMatch matches1to2, Mat outImg, Scalar matchColor, Scalar singlePointColor, MatOfByte matchesMask, int flags)
        {
            if (img1 != null)
            {
                img1.ThrowIfDisposed();
            }
            if (keypoints1 != null)
            {
                keypoints1.ThrowIfDisposed();
            }
            if (img2 != null)
            {
                img2.ThrowIfDisposed();
            }
            if (keypoints2 != null)
            {
                keypoints2.ThrowIfDisposed();
            }
            if (matches1to2 != null)
            {
                matches1to2.ThrowIfDisposed();
            }
            if (outImg != null)
            {
                outImg.ThrowIfDisposed();
            }
            if (matchesMask != null)
            {
                matchesMask.ThrowIfDisposed();
            }

#if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR) || UNITY_5
            Mat keypoints1_mat  = keypoints1;
            Mat keypoints2_mat  = keypoints2;
            Mat matches1to2_mat = matches1to2;
            Mat matchesMask_mat = matchesMask;
            features2d_Features2d_drawMatches_10(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;
#else
            return;
#endif
        }
예제 #5
0
파일: Dnn.cs 프로젝트: jasonta/Portalble
        //
        // C++:  Net cv::dnn::readNet(String framework, vector_uchar bufferModel, vector_uchar bufferConfig = std::vector<uchar>())
        //

        //javadoc: readNet(framework, bufferModel, bufferConfig)
        public static Net readNet(string framework, MatOfByte bufferModel, MatOfByte bufferConfig)
        {
            if (bufferModel != null)
            {
                bufferModel.ThrowIfDisposed();
            }
            if (bufferConfig != null)
            {
                bufferConfig.ThrowIfDisposed();
            }
#if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat bufferModel_mat  = bufferModel;
            Mat bufferConfig_mat = bufferConfig;
            Net retVal           = new Net(dnn_Dnn_readNet_10(framework, bufferModel_mat.nativeObj, bufferConfig_mat.nativeObj));

            return(retVal);
#else
            return(null);
#endif
        }
예제 #6
0
        //javadoc: calcOpticalFlowPyrLK(prevImg, nextImg, prevPts, nextPts, status, err)
        public static void calcOpticalFlowPyrLK(Mat prevImg, Mat nextImg, MatOfPoint2f prevPts, MatOfPoint2f nextPts, MatOfByte status, MatOfFloat err)
        {
            if (prevImg != null)
            {
                prevImg.ThrowIfDisposed();
            }
            if (nextImg != null)
            {
                nextImg.ThrowIfDisposed();
            }
            if (prevPts != null)
            {
                prevPts.ThrowIfDisposed();
            }
            if (nextPts != null)
            {
                nextPts.ThrowIfDisposed();
            }
            if (status != null)
            {
                status.ThrowIfDisposed();
            }
            if (err != null)
            {
                err.ThrowIfDisposed();
            }

#if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR) || UNITY_5
            Mat prevPts_mat = prevPts;
            Mat nextPts_mat = nextPts;
            Mat status_mat  = status;
            Mat err_mat     = err;
            video_Video_calcOpticalFlowPyrLK_12(prevImg.nativeObj, nextImg.nativeObj, prevPts_mat.nativeObj, nextPts_mat.nativeObj, status_mat.nativeObj, err_mat.nativeObj);

            return;
#else
            return;
#endif
        }
예제 #7
0
        //
        // C++:  void calcOpticalFlowPyrLK(Mat prevImg, Mat nextImg, vector_Point2f prevPts, vector_Point2f& nextPts, vector_uchar& status, vector_float& err, Size winSize = Size(21,21), int maxLevel = 3, TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 0.01), int flags = 0, double minEigThreshold = 1e-4)
        //

        //javadoc: calcOpticalFlowPyrLK(prevImg, nextImg, prevPts, nextPts, status, err, winSize, maxLevel, criteria, flags, minEigThreshold)
        public static void calcOpticalFlowPyrLK(Mat prevImg, Mat nextImg, MatOfPoint2f prevPts, MatOfPoint2f nextPts, MatOfByte status, MatOfFloat err, Size winSize, int maxLevel, TermCriteria criteria, int flags, double minEigThreshold)
        {
            if (prevImg != null)
            {
                prevImg.ThrowIfDisposed();
            }
            if (nextImg != null)
            {
                nextImg.ThrowIfDisposed();
            }
            if (prevPts != null)
            {
                prevPts.ThrowIfDisposed();
            }
            if (nextPts != null)
            {
                nextPts.ThrowIfDisposed();
            }
            if (status != null)
            {
                status.ThrowIfDisposed();
            }
            if (err != null)
            {
                err.ThrowIfDisposed();
            }

#if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR) || UNITY_5
            Mat prevPts_mat = prevPts;
            Mat nextPts_mat = nextPts;
            Mat status_mat  = status;
            Mat err_mat     = err;
            video_Video_calcOpticalFlowPyrLK_10(prevImg.nativeObj, nextImg.nativeObj, prevPts_mat.nativeObj, nextPts_mat.nativeObj, status_mat.nativeObj, err_mat.nativeObj, winSize.width, winSize.height, maxLevel, criteria.type, criteria.maxCount, criteria.epsilon, flags, minEigThreshold);

            return;
#else
            return;
#endif
        }
예제 #8
0
        //javadoc: calcOpticalFlowPyrLK(prevImg, nextImg, prevPts, nextPts, status, err, winSize, maxLevel)
        public static void calcOpticalFlowPyrLK(Mat prevImg, Mat nextImg, MatOfPoint2f prevPts, MatOfPoint2f nextPts, MatOfByte status, MatOfFloat err, Size winSize, int maxLevel)
        {
            if (prevImg != null)
            {
                prevImg.ThrowIfDisposed();
            }
            if (nextImg != null)
            {
                nextImg.ThrowIfDisposed();
            }
            if (prevPts != null)
            {
                prevPts.ThrowIfDisposed();
            }
            if (nextPts != null)
            {
                nextPts.ThrowIfDisposed();
            }
            if (status != null)
            {
                status.ThrowIfDisposed();
            }
            if (err != null)
            {
                err.ThrowIfDisposed();
            }
#if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat prevPts_mat = prevPts;
            Mat nextPts_mat = nextPts;
            Mat status_mat  = status;
            Mat err_mat     = err;
            video_Video_calcOpticalFlowPyrLK_11(prevImg.nativeObj, nextImg.nativeObj, prevPts_mat.nativeObj, nextPts_mat.nativeObj, status_mat.nativeObj, err_mat.nativeObj, winSize.width, winSize.height, maxLevel);

            return;
#else
            return;
#endif
        }