Example #1
0
        //javadoc: NMSBoxes(bboxes, scores, score_threshold, nms_threshold, indices)
        public static void NMSBoxes(MatOfRect bboxes, MatOfFloat scores, float score_threshold, float nms_threshold, MatOfInt indices)
        {
            if (bboxes != null)
            {
                bboxes.ThrowIfDisposed();
            }
            if (scores != null)
            {
                scores.ThrowIfDisposed();
            }
            if (indices != null)
            {
                indices.ThrowIfDisposed();
            }
#if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat bboxes_mat  = bboxes;
            Mat scores_mat  = scores;
            Mat indices_mat = indices;
            dnn_Dnn_NMSBoxes_12(bboxes_mat.nativeObj, scores_mat.nativeObj, score_threshold, nms_threshold, indices_mat.nativeObj);

            return;
#else
            return;
#endif
        }
        //javadoc: CascadeClassifier::detectMultiScale2(image, objects, numDetections)
        public void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections)
        {
            ThrowIfDisposed();
            if (image != null)
            {
                image.ThrowIfDisposed();
            }
            if (objects != null)
            {
                objects.ThrowIfDisposed();
            }
            if (numDetections != null)
            {
                numDetections.ThrowIfDisposed();
            }
#if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat objects_mat       = objects;
            Mat numDetections_mat = numDetections;
            objdetect_CascadeClassifier_detectMultiScale2_15(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj);

            return;
#else
            return;
#endif
        }
        //javadoc: CascadeClassifier::detectMultiScale2(image, objects, numDetections, scaleFactor, minNeighbors, flags, minSize)
        public void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor, int minNeighbors, int flags, Size minSize)
        {
            ThrowIfDisposed();
            if (image != null)
            {
                image.ThrowIfDisposed();
            }
            if (objects != null)
            {
                objects.ThrowIfDisposed();
            }
            if (numDetections != null)
            {
                numDetections.ThrowIfDisposed();
            }
#if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat objects_mat       = objects;
            Mat numDetections_mat = numDetections;
            objdetect_CascadeClassifier_detectMultiScale2_11(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height);

            return;
#else
            return;
#endif
        }
        //javadoc: CascadeClassifier::detectMultiScale3(image, objects, rejectLevels, levelWeights, scaleFactor, minNeighbors, flags, minSize, maxSize)
        public void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize)
        {
            ThrowIfDisposed();
            if (image != null)
            {
                image.ThrowIfDisposed();
            }
            if (objects != null)
            {
                objects.ThrowIfDisposed();
            }
            if (rejectLevels != null)
            {
                rejectLevels.ThrowIfDisposed();
            }
            if (levelWeights != null)
            {
                levelWeights.ThrowIfDisposed();
            }
#if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat objects_mat      = objects;
            Mat rejectLevels_mat = rejectLevels;
            Mat levelWeights_mat = levelWeights;
            objdetect_CascadeClassifier_detectMultiScale3_11(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height, maxSize.width, maxSize.height);

            return;
#else
            return;
#endif
        }
        //javadoc: CascadeClassifier::detectMultiScale3(image, objects, rejectLevels, levelWeights)
        public void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights)
        {
            ThrowIfDisposed();
            if (image != null)
            {
                image.ThrowIfDisposed();
            }
            if (objects != null)
            {
                objects.ThrowIfDisposed();
            }
            if (rejectLevels != null)
            {
                rejectLevels.ThrowIfDisposed();
            }
            if (levelWeights != null)
            {
                levelWeights.ThrowIfDisposed();
            }
#if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat objects_mat      = objects;
            Mat rejectLevels_mat = rejectLevels;
            Mat levelWeights_mat = levelWeights;
            objdetect_CascadeClassifier_detectMultiScale3_16(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj);

            return;
#else
            return;
#endif
        }
Example #6
0
        //
        // 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
        }
Example #7
0
        //
        // C++: static Ptr_BRISK cv::BRISK::create(int thresh, int octaves, vector_float radiusList, vector_int numberList, float dMax = 5.85f, float dMin = 8.2f, vector_int indexChange = std::vector<int>())
        //

        //javadoc: BRISK::create(thresh, octaves, radiusList, numberList, dMax, dMin, indexChange)
        public static BRISK create(int thresh, int octaves, MatOfFloat radiusList, MatOfInt numberList, float dMax, float dMin, MatOfInt indexChange)
        {
            if (radiusList != null)
            {
                radiusList.ThrowIfDisposed();
            }
            if (numberList != null)
            {
                numberList.ThrowIfDisposed();
            }
            if (indexChange != null)
            {
                indexChange.ThrowIfDisposed();
            }
#if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat   radiusList_mat  = radiusList;
            Mat   numberList_mat  = numberList;
            Mat   indexChange_mat = indexChange;
            BRISK retVal          = BRISK.__fromPtr__(features2d_BRISK_create_10(thresh, octaves, radiusList_mat.nativeObj, numberList_mat.nativeObj, dMax, dMin, indexChange_mat.nativeObj));

            return(retVal);
#else
            return(null);
#endif
        }
Example #8
0
        //
        // C++:  void cv::dnn::Net::getMemoryConsumption(int layerId, MatShape netInputShape, size_t& weights, size_t& blobs)
        //

        //javadoc: Net::getMemoryConsumption(layerId, netInputShape, weights, blobs)
        public void getMemoryConsumption(int layerId, MatOfInt netInputShape, long[] weights, long[] blobs)
        {
            ThrowIfDisposed();
            if (netInputShape != null)
            {
                netInputShape.ThrowIfDisposed();
            }
#if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat      netInputShape_mat = netInputShape;
            double[] weights_out       = new double[1];
            double[] blobs_out         = new double[1];
            dnn_Net_getMemoryConsumption_11(nativeObj, layerId, netInputShape_mat.nativeObj, weights_out, blobs_out);
            if (weights != null)
            {
                weights[0] = (long)weights_out[0];
            }
            if (blobs != null)
            {
                blobs[0] = (long)blobs_out[0];
            }
            return;
#else
            return;
#endif
        }
Example #9
0
        //
        // C++: static Ptr_FREAK cv::xfeatures2d::FREAK::create(bool orientationNormalized = true, bool scaleNormalized = true, float patternScale = 22.0f, int nOctaves = 4, vector_int selectedPairs = std::vector<int>())
        //

        //javadoc: FREAK::create(orientationNormalized, scaleNormalized, patternScale, nOctaves, selectedPairs)
        public static FREAK create(bool orientationNormalized, bool scaleNormalized, float patternScale, int nOctaves, MatOfInt selectedPairs)
        {
            if (selectedPairs != null)
            {
                selectedPairs.ThrowIfDisposed();
            }
#if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat   selectedPairs_mat = selectedPairs;
            FREAK retVal            = FREAK.__fromPtr__(xfeatures2d_FREAK_create_10(orientationNormalized, scaleNormalized, patternScale, nOctaves, selectedPairs_mat.nativeObj));

            return(retVal);
#else
            return(null);
#endif
        }
Example #10
0
        //
        // C++:  void setInitSeedIndexes(vector_int initSeedIndexes)
        //

        //javadoc: PCTSignatures::setInitSeedIndexes(initSeedIndexes)
        public void setInitSeedIndexes(MatOfInt initSeedIndexes)
        {
            ThrowIfDisposed();
            if (initSeedIndexes != null)
            {
                initSeedIndexes.ThrowIfDisposed();
            }
#if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat initSeedIndexes_mat = initSeedIndexes;
            xfeatures2d_PCTSignatures_setInitSeedIndexes_10(nativeObj, initSeedIndexes_mat.nativeObj);

            return;
#else
            return;
#endif
        }
Example #11
0
        //
        // C++:  void getLeadingEdgeList(vector_int& leadingEdgeList)
        //

        //javadoc: Subdiv2D::getLeadingEdgeList(leadingEdgeList)
        public void getLeadingEdgeList(MatOfInt leadingEdgeList)
        {
            ThrowIfDisposed();
            if (leadingEdgeList != null)
            {
                leadingEdgeList.ThrowIfDisposed();
            }
#if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat leadingEdgeList_mat = leadingEdgeList;
            imgproc_Subdiv2D_getLeadingEdgeList_10(nativeObj, leadingEdgeList_mat.nativeObj);

            return;
#else
            return;
#endif
        }
Example #12
0
        //
        // C++:  int64 cv::dnn::Net::getFLOPS(int layerId, MatShape netInputShape)
        //

        //javadoc: Net::getFLOPS(layerId, netInputShape)
        public long getFLOPS(int layerId, MatOfInt netInputShape)
        {
            ThrowIfDisposed();
            if (netInputShape != null)
            {
                netInputShape.ThrowIfDisposed();
            }
#if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat  netInputShape_mat = netInputShape;
            long retVal            = dnn_Net_getFLOPS_11(nativeObj, layerId, netInputShape_mat.nativeObj);

            return(retVal);
#else
            return(-1);
#endif
        }
Example #13
0
        //
        // C++:  bool cv::imwrite(String filename, Mat img, vector_int _params = std::vector<int>())
        //

        //javadoc: imwrite(filename, img, _params)
        public static bool imwrite(string filename, Mat img, MatOfInt _params)
        {
            if (img != null)
            {
                img.ThrowIfDisposed();
            }
            if (_params != null)
            {
                _params.ThrowIfDisposed();
            }
#if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat  _params_mat = _params;
            bool retVal      = imgcodecs_Imgcodecs_imwrite_10(filename, img.nativeObj, _params_mat.nativeObj);

            return(retVal);
#else
            return(false);
#endif
        }
Example #14
0
        //javadoc: BRISK::create(radiusList, numberList)
        public static BRISK create(MatOfFloat radiusList, MatOfInt numberList)
        {
            if (radiusList != null)
            {
                radiusList.ThrowIfDisposed();
            }
            if (numberList != null)
            {
                numberList.ThrowIfDisposed();
            }
#if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat   radiusList_mat = radiusList;
            Mat   numberList_mat = numberList;
            BRISK retVal         = BRISK.__fromPtr__(features2d_BRISK_create_111(radiusList_mat.nativeObj, numberList_mat.nativeObj));

            return(retVal);
#else
            return(null);
#endif
        }
Example #15
0
        //
        // C++:  bool imwrite(string filename, Mat img, vector_int params = vector<int>())
        //

        /**
         * <p>Saves an image to a specified file.</p>
         *
         * <p>The function <code>imwrite</code> saves the image to the specified file. The
         * image format is chosen based on the <code>filename</code> extension (see
         * "imread" for the list of extensions). Only 8-bit (or 16-bit unsigned
         * (<code>CV_16U</code>) in case of PNG, JPEG 2000, and TIFF) single-channel or
         * 3-channel (with 'BGR' channel order) images can be saved using this function.
         * If the format, depth or channel order is different, use "Mat.convertTo", and
         * "cvtColor" to convert it before saving. Or, use the universal "FileStorage"
         * I/O functions to save the image to XML or YAML format.
         * It is possible to store PNG images with an alpha channel using this function.
         * To do this, create 8-bit (or 16-bit) 4-channel image BGRA, where the alpha
         * channel goes last. Fully transparent pixels should have alpha set to 0, fully
         * opaque pixels should have alpha set to 255/65535. The sample below shows how
         * to create such a BGRA image and store to PNG file. It also demonstrates how
         * to set custom compression parameters <code></p>
         *
         * <p>// C++ code:</p>
         *
         * <p>#include <vector></p>
         *
         * <p>#include <stdio.h></p>
         *
         * <p>#include <opencv2/opencv.hpp></p>
         *
         * <p>using namespace cv;</p>
         *
         * <p>using namespace std;</p>
         *
         * <p>void createAlphaMat(Mat &mat)</p>
         *
         *
         * <p>for (int i = 0; i < mat.rows; ++i) {</p>
         *
         * <p>for (int j = 0; j < mat.cols; ++j) {</p>
         *
         * <p>Vec4b& rgba = mat.at<Vec4b>(i, j);</p>
         *
         * <p>rgba[0] = UCHAR_MAX;</p>
         *
         * <p>rgba[1] = saturate_cast<uchar>((float (mat.cols - j)) / ((float)mat.cols) *
         * UCHAR_MAX);</p>
         *
         * <p>rgba[2] = saturate_cast<uchar>((float (mat.rows - i)) / ((float)mat.rows) *
         * UCHAR_MAX);</p>
         *
         * <p>rgba[3] = saturate_cast<uchar>(0.5 * (rgba[1] + rgba[2]));</p>
         *
         *
         *
         *
         * <p>int main(int argv, char argc)</p>
         *
         *
         * <p>// Create mat with alpha channel</p>
         *
         * <p>Mat mat(480, 640, CV_8UC4);</p>
         *
         * <p>createAlphaMat(mat);</p>
         *
         * <p>vector<int> compression_params;</p>
         *
         * <p>compression_params.push_back(CV_IMWRITE_PNG_COMPRESSION);</p>
         *
         * <p>compression_params.push_back(9);</p>
         *
         * <p>try {</p>
         *
         * <p>imwrite("alpha.png", mat, compression_params);</p>
         *
         *
         * <p>catch (runtime_error& ex) {</p>
         *
         * <p>fprintf(stderr, "Exception converting image to PNG format: %sn", ex.what());</p>
         *
         * <p>return 1;</p>
         *
         *
         * <p>fprintf(stdout, "Saved PNG file with alpha data.n");</p>
         *
         * <p>return 0;</p>
         *
         *
         * @param filename Name of the file.
         * @param img a img
         * @param params Format-specific save parameters encoded as pairs
         * <code>paramId_1, paramValue_1, paramId_2, paramValue_2,...</code>. The
         * following parameters are currently supported:
         * <ul>
         *   <li> For JPEG, it can be a quality (<code>CV_IMWRITE_JPEG_QUALITY</code>)
         * from 0 to 100 (the higher is the better). Default value is 95.
         *   <li> For PNG, it can be the compression level (<code>CV_IMWRITE_PNG_COMPRESSION</code>)
         * from 0 to 9. A higher value means a smaller size and longer compression time.
         * Default value is 3.
         *   <li> For PPM, PGM, or PBM, it can be a binary format flag (<code>CV_IMWRITE_PXM_BINARY</code>),
         * 0 or 1. Default value is 1.
         * </ul>
         *
         * @see <a href="http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html#imwrite">org.opencv.highgui.Highgui.imwrite</a>
         */
        public static bool imwrite(string filename, Mat img, MatOfInt _params)
        {
            if (img != null)
            {
                img.ThrowIfDisposed();
            }
            if (_params != null)
            {
                _params.ThrowIfDisposed();
            }

                                                #if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR) || UNITY_5
            Mat  params_mat = _params;
            bool retVal     = highgui_Highgui_imwrite_10(filename, img.nativeObj, params_mat.nativeObj);

            return(retVal);
                                                #else
            return(false);
                                                #endif
        }
Example #16
0
        //javadoc: groupRectangles(rectList, weights, groupThreshold)
        public static void groupRectangles(MatOfRect rectList, MatOfInt weights, int groupThreshold)
        {
            if (rectList != null)
            {
                rectList.ThrowIfDisposed();
            }
            if (weights != null)
            {
                weights.ThrowIfDisposed();
            }
#if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat rectList_mat = rectList;
            Mat weights_mat  = weights;
            objdetect_Objdetect_groupRectangles_11(rectList_mat.nativeObj, weights_mat.nativeObj, groupThreshold);

            return;
#else
            return;
#endif
        }
Example #17
0
        //
        // C++: static Ptr_PCTSignatures create(vector_Point2f initSamplingPoints, vector_int initClusterSeedIndexes)
        //

        //javadoc: PCTSignatures::create(initSamplingPoints, initClusterSeedIndexes)
        public static PCTSignatures create(MatOfPoint2f initSamplingPoints, MatOfInt initClusterSeedIndexes)
        {
            if (initSamplingPoints != null)
            {
                initSamplingPoints.ThrowIfDisposed();
            }
            if (initClusterSeedIndexes != null)
            {
                initClusterSeedIndexes.ThrowIfDisposed();
            }
#if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat           initSamplingPoints_mat     = initSamplingPoints;
            Mat           initClusterSeedIndexes_mat = initClusterSeedIndexes;
            PCTSignatures retVal = PCTSignatures.__fromPtr__(xfeatures2d_PCTSignatures_create_13(initSamplingPoints_mat.nativeObj, initClusterSeedIndexes_mat.nativeObj));

            return(retVal);
#else
            return(null);
#endif
        }
Example #18
0
        //
        // C++:  void Subdiv2D::getVoronoiFacetList(vector_int idx, vector_vector_Point2f& facetList, vector_Point2f& facetCenters)
        //

        public void getVoronoiFacetList(MatOfInt idx, List <MatOfPoint2f> facetList, MatOfPoint2f facetCenters)
        {
            if (idx != null)
            {
                idx.ThrowIfDisposed();
            }
            if (facetCenters != null)
            {
                facetCenters.ThrowIfDisposed();
            }
            ThrowIfDisposed();

                                                #if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR) || UNITY_5
            Mat idx_mat          = idx;
            Mat facetList_mat    = new Mat();
            Mat facetCenters_mat = facetCenters;
            imgproc_Subdiv2D_getVoronoiFacetList_10(nativeObj, idx_mat.nativeObj, facetList_mat.nativeObj, facetCenters_mat.nativeObj);
            Converters.Mat_to_vector_vector_Point2f(facetList_mat, facetList);
            return;
                                                #else
            return;
                                                #endif
        }