Esempio n. 1
0
        void DoProcess()
        {
            if (!(image.Value is OpenCVForUnityPlayMakerActions.Mat))
            {
                LogError("image is not initialized. Add Action \"newMat\".");
                return;
            }
            OpenCVForUnity.CoreModule.Mat wrapped_image = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.Mat, OpenCVForUnity.CoreModule.Mat>(image);

            if (!(er_filter1.Value is OpenCVForUnityPlayMakerActions.ERFilter))
            {
                LogError("er_filter1 is not initialized. Add Action \"newERFilter\".");
                return;
            }
            OpenCVForUnity.TextModule.ERFilter wrapped_er_filter1 = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.ERFilter, OpenCVForUnity.TextModule.ERFilter>(er_filter1);

            if (!(er_filter2.Value is OpenCVForUnityPlayMakerActions.ERFilter))
            {
                LogError("er_filter2 is not initialized. Add Action \"newERFilter\".");
                return;
            }
            OpenCVForUnity.TextModule.ERFilter wrapped_er_filter2 = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.ERFilter, OpenCVForUnity.TextModule.ERFilter>(er_filter2);

            if (!(groups_rects.Value is OpenCVForUnityPlayMakerActions.MatOfRect))
            {
                LogError("groups_rects is not initialized. Add Action \"newMatOfRect\".");
                return;
            }
            OpenCVForUnity.CoreModule.MatOfRect wrapped_groups_rects = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.MatOfRect, OpenCVForUnity.CoreModule.MatOfRect>(groups_rects);

            OpenCVForUnity.TextModule.Text.detectRegions(wrapped_image, wrapped_er_filter1, wrapped_er_filter2, wrapped_groups_rects, method.Value, filename.Value);
        }
Esempio n. 2
0
        //javadoc: detectRegions(image, er_filter1, er_filter2, groups_rects)
        public static void detectRegions(Mat image, ERFilter er_filter1, ERFilter er_filter2, MatOfRect groups_rects)
        {
            if (image != null)
            {
                image.ThrowIfDisposed();
            }
            if (er_filter1 != null)
            {
                er_filter1.ThrowIfDisposed();
            }
            if (er_filter2 != null)
            {
                er_filter2.ThrowIfDisposed();
            }
            if (groups_rects != null)
            {
                groups_rects.ThrowIfDisposed();
            }
#if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat groups_rects_mat = groups_rects;
            text_Text_detectRegions_13(image.nativeObj, er_filter1.getNativeObjAddr(), er_filter2.getNativeObjAddr(), groups_rects_mat.nativeObj);

            return;
#else
            return;
#endif
        }
        void DoProcess()
        {
            if (!(image.Value is OpenCVForUnityPlayMakerActions.Mat))
            {
                LogError("image is not initialized. Add Action \"newMat\".");
                return;
            }
            OpenCVForUnity.CoreModule.Mat wrapped_image = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.Mat, OpenCVForUnity.CoreModule.Mat>(image);

            if (!(er_filter1.Value is OpenCVForUnityPlayMakerActions.ERFilter))
            {
                LogError("er_filter1 is not initialized. Add Action \"newERFilter\".");
                return;
            }
            OpenCVForUnity.TextModule.ERFilter wrapped_er_filter1 = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.ERFilter, OpenCVForUnity.TextModule.ERFilter>(er_filter1);

            if (!(er_filter2.Value is OpenCVForUnityPlayMakerActions.ERFilter))
            {
                LogError("er_filter2 is not initialized. Add Action \"newERFilter\".");
                return;
            }
            OpenCVForUnity.TextModule.ERFilter wrapped_er_filter2 = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.ERFilter, OpenCVForUnity.TextModule.ERFilter>(er_filter2);

            List <OpenCVForUnity.CoreModule.MatOfPoint> wrapped_regions = new List <OpenCVForUnity.CoreModule.MatOfPoint>();

            OpenCVForUnityPlayMakerActionsUtils.ConvertFsmArrayToList <OpenCVForUnityPlayMakerActions.MatOfPoint, OpenCVForUnity.CoreModule.MatOfPoint>(regions, wrapped_regions);

            OpenCVForUnity.TextModule.Text.detectRegions(wrapped_image, wrapped_er_filter1, wrapped_er_filter2, wrapped_regions);

            OpenCVForUnityPlayMakerActionsUtils.ConvertListToFsmArray <OpenCVForUnity.CoreModule.MatOfPoint, OpenCVForUnityPlayMakerActions.MatOfPoint>(wrapped_regions, regions);
        }
Esempio n. 4
0
        //javadoc: createERFilterNM1(filename, thresholdDelta, minArea, maxArea, minProbability)
        public static ERFilter createERFilterNM1(string filename, int thresholdDelta, float minArea, float maxArea, float minProbability)
        {
#if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            ERFilter retVal = ERFilter.__fromPtr__(text_Text_createERFilterNM1_12(filename, thresholdDelta, minArea, maxArea, minProbability));

            return(retVal);
#else
            return(null);
#endif
        }
Esempio n. 5
0
        //javadoc: createERFilterNM2(filename)
        public static ERFilter createERFilterNM2(string filename)
        {
#if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            ERFilter retVal = ERFilter.__fromPtr__(text_Text_createERFilterNM2_11(filename));

            return(retVal);
#else
            return(null);
#endif
        }
Esempio n. 6
0
        //
        // C++:  void cv::text::detectRegions(Mat image, Ptr_ERFilter er_filter1, Ptr_ERFilter er_filter2, vector_vector_Point& regions)
        //

        /**
         * Converts MSER contours (vector&lt;Point&gt;) to ERStat regions.
         *
         * param image Source image CV_8UC1 from which the MSERs where extracted.
         *
         *
         * param regions Output where the ERStat regions are stored.
         *
         * It takes as input the contours provided by the OpenCV MSER feature detector and returns as output
         * two vectors of ERStats. This is because MSER() output contains both MSER+ and MSER- regions in a
         * single vector&lt;Point&gt;, the function separates them in two different vectors (this is as if the
         * ERStats where extracted from two different channels).
         *
         * An example of MSERsToERStats in use can be found in the text detection webcam_demo:
         * &lt;https://github.com/opencv/opencv_contrib/blob/master/modules/text/samples/webcam_demo.cpp&gt;
         * param er_filter1 automatically generated
         * param er_filter2 automatically generated
         */
        public static void detectRegions(Mat image, ERFilter er_filter1, ERFilter er_filter2, List <MatOfPoint> regions)
        {
            if (image != null)
            {
                image.ThrowIfDisposed();
            }
            if (er_filter1 != null)
            {
                er_filter1.ThrowIfDisposed();
            }
            if (er_filter2 != null)
            {
                er_filter2.ThrowIfDisposed();
            }
            Mat regions_mat = new Mat();

            text_Text_detectRegions_14(image.nativeObj, er_filter1.getNativeObjAddr(), er_filter2.getNativeObjAddr(), regions_mat.nativeObj);
            Converters.Mat_to_vector_vector_Point(regions_mat, regions);
            regions_mat.release();
        }
Esempio n. 7
0
        /**
         * Extracts text regions from image.
         *
         * param image Source image where text blocks needs to be extracted from.  Should be CV_8UC3 (color).
         * param er_filter1 Extremal Region Filter for the 1st stage classifier of N&amp;M algorithm CITE: Neumann12
         * param er_filter2 Extremal Region Filter for the 2nd stage classifier of N&amp;M algorithm CITE: Neumann12
         * param groups_rects Output list of rectangle blocks with text
         */
        public static void detectRegions(Mat image, ERFilter er_filter1, ERFilter er_filter2, MatOfRect groups_rects)
        {
            if (image != null)
            {
                image.ThrowIfDisposed();
            }
            if (er_filter1 != null)
            {
                er_filter1.ThrowIfDisposed();
            }
            if (er_filter2 != null)
            {
                er_filter2.ThrowIfDisposed();
            }
            if (groups_rects != null)
            {
                groups_rects.ThrowIfDisposed();
            }
            Mat groups_rects_mat = groups_rects;

            text_Text_detectRegions_13(image.nativeObj, er_filter1.getNativeObjAddr(), er_filter2.getNativeObjAddr(), groups_rects_mat.nativeObj);
        }
Esempio n. 8
0
        //
        // C++:  void cv::text::detectRegions(Mat image, Ptr_ERFilter er_filter1, Ptr_ERFilter er_filter2, vector_Rect& groups_rects, int method = ERGROUPING_ORIENTATION_HORIZ, String filename = String(), float minProbability = (float)0.5)
        //

        /**
         * Extracts text regions from image.
         *
         * param image Source image where text blocks needs to be extracted from.  Should be CV_8UC3 (color).
         * param er_filter1 Extremal Region Filter for the 1st stage classifier of N&amp;M algorithm CITE: Neumann12
         * param er_filter2 Extremal Region Filter for the 2nd stage classifier of N&amp;M algorithm CITE: Neumann12
         * param groups_rects Output list of rectangle blocks with text
         * param method Grouping method (see text::erGrouping_Modes). Can be one of ERGROUPING_ORIENTATION_HORIZ, ERGROUPING_ORIENTATION_ANY.
         * param filename The XML or YAML file with the classifier model (e.g. samples/trained_classifier_erGrouping.xml). Only to use when grouping method is ERGROUPING_ORIENTATION_ANY.
         * param minProbability The minimum probability for accepting a group. Only to use when grouping method is ERGROUPING_ORIENTATION_ANY.
         */
        public static void detectRegions(Mat image, ERFilter er_filter1, ERFilter er_filter2, MatOfRect groups_rects, int method, string filename, float minProbability)
        {
            if (image != null)
            {
                image.ThrowIfDisposed();
            }
            if (er_filter1 != null)
            {
                er_filter1.ThrowIfDisposed();
            }
            if (er_filter2 != null)
            {
                er_filter2.ThrowIfDisposed();
            }
            if (groups_rects != null)
            {
                groups_rects.ThrowIfDisposed();
            }
            Mat groups_rects_mat = groups_rects;

            text_Text_detectRegions_10(image.nativeObj, er_filter1.getNativeObjAddr(), er_filter2.getNativeObjAddr(), groups_rects_mat.nativeObj, method, filename, minProbability);
        }
Esempio n. 9
0
        //
        // C++:  void cv::text::detectRegions(Mat image, Ptr_ERFilter er_filter1, Ptr_ERFilter er_filter2, vector_vector_Point& regions)
        //

        //javadoc: detectRegions(image, er_filter1, er_filter2, regions)
        public static void detectRegions(Mat image, ERFilter er_filter1, ERFilter er_filter2, List <MatOfPoint> regions)
        {
            if (image != null)
            {
                image.ThrowIfDisposed();
            }
            if (er_filter1 != null)
            {
                er_filter1.ThrowIfDisposed();
            }
            if (er_filter2 != null)
            {
                er_filter2.ThrowIfDisposed();
            }
#if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat regions_mat = new Mat();
            text_Text_detectRegions_14(image.nativeObj, er_filter1.getNativeObjAddr(), er_filter2.getNativeObjAddr(), regions_mat.nativeObj);
            Converters.Mat_to_vector_vector_Point(regions_mat, regions);
            regions_mat.release();
            return;
#else
            return;
#endif
        }
Esempio n. 10
0
        //
        // C++:  Ptr_ERFilter cv::text::createERFilterNM1(Ptr_ERFilter_Callback cb, int thresholdDelta = 1, float minArea = (float)0.00025, float maxArea = (float)0.13, float minProbability = (float)0.4, bool nonMaxSuppression = true, float minProbabilityDiff = (float)0.1)
        //

        // Unknown type 'Ptr_ERFilter_Callback' (I), skipping the function


        //
        // C++:  Ptr_ERFilter cv::text::createERFilterNM1(String filename, int thresholdDelta = 1, float minArea = (float)0.00025, float maxArea = (float)0.13, float minProbability = (float)0.4, bool nonMaxSuppression = true, float minProbabilityDiff = (float)0.1)
        //

        /**
         * Reads an Extremal Region Filter for the 1st stage classifier of N&amp;M algorithm
         *     from the provided path e.g. /path/to/cpp/trained_classifierNM1.xml
         *
         * param filename automatically generated
         * param thresholdDelta automatically generated
         * param minArea automatically generated
         * param maxArea automatically generated
         * param minProbability automatically generated
         * param nonMaxSuppression automatically generated
         * param minProbabilityDiff automatically generated
         * return automatically generated
         */
        public static ERFilter createERFilterNM1(string filename, int thresholdDelta, float minArea, float maxArea, float minProbability, bool nonMaxSuppression, float minProbabilityDiff)
        {
            return(ERFilter.__fromPtr__(text_Text_createERFilterNM1_10(filename, thresholdDelta, minArea, maxArea, minProbability, nonMaxSuppression, minProbabilityDiff)));
        }
Esempio n. 11
0
 /**
  * Reads an Extremal Region Filter for the 2nd stage classifier of N&amp;M algorithm
  *     from the provided path e.g. /path/to/cpp/trained_classifierNM2.xml
  *
  * param filename automatically generated
  * return automatically generated
  */
 public static ERFilter createERFilterNM2(string filename)
 {
     return(ERFilter.__fromPtr__(text_Text_createERFilterNM2_11(filename)));
 }
Esempio n. 12
0
        //
        // C++:  Ptr_ERFilter cv::text::createERFilterNM2(Ptr_ERFilter_Callback cb, float minProbability = (float)0.3)
        //

        // Unknown type 'Ptr_ERFilter_Callback' (I), skipping the function


        //
        // C++:  Ptr_ERFilter cv::text::createERFilterNM2(String filename, float minProbability = (float)0.3)
        //

        /**
         * Reads an Extremal Region Filter for the 2nd stage classifier of N&amp;M algorithm
         *     from the provided path e.g. /path/to/cpp/trained_classifierNM2.xml
         *
         * param filename automatically generated
         * param minProbability automatically generated
         * return automatically generated
         */
        public static ERFilter createERFilterNM2(string filename, float minProbability)
        {
            return(ERFilter.__fromPtr__(text_Text_createERFilterNM2_10(filename, minProbability)));
        }
Esempio n. 13
0
 /**
  * Reads an Extremal Region Filter for the 1st stage classifier of N&amp;M algorithm
  *     from the provided path e.g. /path/to/cpp/trained_classifierNM1.xml
  *
  * param filename automatically generated
  * param thresholdDelta automatically generated
  * return automatically generated
  */
 public static ERFilter createERFilterNM1(string filename, int thresholdDelta)
 {
     return(ERFilter.__fromPtr__(text_Text_createERFilterNM1_15(filename, thresholdDelta)));
 }
Esempio n. 14
0
 /**
  * Reads an Extremal Region Filter for the 1st stage classifier of N&amp;M algorithm
  *     from the provided path e.g. /path/to/cpp/trained_classifierNM1.xml
  *
  * param filename automatically generated
  * param thresholdDelta automatically generated
  * param minArea automatically generated
  * param maxArea automatically generated
  * return automatically generated
  */
 public static ERFilter createERFilterNM1(string filename, int thresholdDelta, float minArea, float maxArea)
 {
     return(ERFilter.__fromPtr__(text_Text_createERFilterNM1_13(filename, thresholdDelta, minArea, maxArea)));
 }
 public ERFilter(OpenCVForUnity.TextModule.ERFilter nativeObj) : base(nativeObj)
 {
 }