123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357 |
- //#if !UNITY_WSA_10_0
- //using OpenCVForUnity.CoreModule;
- //using OpenCVForUnity.UtilsModule;
- //using System;
- //using System.Collections.Generic;
- //using System.Runtime.InteropServices;
- //namespace OpenCVForUnity.TextModule
- //{
- // // C++: class OCRTesseract
- // /**
- // * OCRTesseract class provides an interface with the tesseract-ocr API (v3.02.02) in C++.
- // *
- // * Notice that it is compiled only when tesseract-ocr is correctly installed.
- // *
- // * <b>Note:</b>
- // * <ul>
- // * <li>
- // * (C++) An example of OCRTesseract recognition combined with scene text detection can be found
- // * at the end_to_end_recognition demo:
- // * <https://github.com/opencv/opencv_contrib/blob/master/modules/text/samples/end_to_end_recognition.cpp>
- // * <ul>
- // * <li>
- // * (C++) Another example of OCRTesseract recognition combined with scene text detection can be
- // * found at the webcam_demo:
- // * <https://github.com/opencv/opencv_contrib/blob/master/modules/text/samples/webcam_demo.cpp>
- // * </li>
- // * </ul>
- // * </li>
- // * </ul>
- // */
- // public class OCRTesseract : BaseOCR
- // {
- // protected override void Dispose(bool disposing)
- // {
- // try
- // {
- // if (disposing)
- // {
- // }
- // if (IsEnabledDispose)
- // {
- // if (nativeObj != IntPtr.Zero)
- // text_OCRTesseract_delete(nativeObj);
- // nativeObj = IntPtr.Zero;
- // }
- // }
- // finally
- // {
- // base.Dispose(disposing);
- // }
- // }
- // protected internal OCRTesseract(IntPtr addr) : base(addr) { }
- // // internal usage only
- // public static new OCRTesseract __fromPtr__(IntPtr addr) { return new OCRTesseract(addr); }
- // //
- // // C++: String cv::text::OCRTesseract::run(Mat image, int min_confidence, int component_level = 0)
- // //
- // /**
- // * Recognize text using the tesseract-ocr API.
- // *
- // * Takes image on input and returns recognized text in the output_text parameter. Optionally
- // * provides also the Rects for individual text elements found (e.g. words), and the list of those
- // * text elements with their confidence values.
- // *
- // * param image Input image CV_8UC1 or CV_8UC3
- // * text elements found (e.g. words or text lines).
- // * recognition of individual text elements found (e.g. words or text lines).
- // * for the recognition of individual text elements found (e.g. words or text lines).
- // * param component_level OCR_LEVEL_WORD (by default), or OCR_LEVEL_TEXTLINE.
- // * param min_confidence automatically generated
- // * return automatically generated
- // */
- // public string run(Mat image, int min_confidence, int component_level)
- // {
- // ThrowIfDisposed();
- // if (image != null) image.ThrowIfDisposed();
- // string retVal = Marshal.PtrToStringAnsi(DisposableObject.ThrowIfNullIntPtr(text_OCRTesseract_run_10(nativeObj, image.nativeObj, min_confidence, component_level)));
- // return retVal;
- // }
- // /**
- // * Recognize text using the tesseract-ocr API.
- // *
- // * Takes image on input and returns recognized text in the output_text parameter. Optionally
- // * provides also the Rects for individual text elements found (e.g. words), and the list of those
- // * text elements with their confidence values.
- // *
- // * param image Input image CV_8UC1 or CV_8UC3
- // * text elements found (e.g. words or text lines).
- // * recognition of individual text elements found (e.g. words or text lines).
- // * for the recognition of individual text elements found (e.g. words or text lines).
- // * param min_confidence automatically generated
- // * return automatically generated
- // */
- // public string run(Mat image, int min_confidence)
- // {
- // ThrowIfDisposed();
- // if (image != null) image.ThrowIfDisposed();
- // string retVal = Marshal.PtrToStringAnsi(DisposableObject.ThrowIfNullIntPtr(text_OCRTesseract_run_11(nativeObj, image.nativeObj, min_confidence)));
- // return retVal;
- // }
- // //
- // // C++: String cv::text::OCRTesseract::run(Mat image, Mat mask, int min_confidence, int component_level = 0)
- // //
- // public string run(Mat image, Mat mask, int min_confidence, int component_level)
- // {
- // ThrowIfDisposed();
- // if (image != null) image.ThrowIfDisposed();
- // if (mask != null) mask.ThrowIfDisposed();
- // string retVal = Marshal.PtrToStringAnsi(DisposableObject.ThrowIfNullIntPtr(text_OCRTesseract_run_12(nativeObj, image.nativeObj, mask.nativeObj, min_confidence, component_level)));
- // return retVal;
- // }
- // public string run(Mat image, Mat mask, int min_confidence)
- // {
- // ThrowIfDisposed();
- // if (image != null) image.ThrowIfDisposed();
- // if (mask != null) mask.ThrowIfDisposed();
- // string retVal = Marshal.PtrToStringAnsi(DisposableObject.ThrowIfNullIntPtr(text_OCRTesseract_run_13(nativeObj, image.nativeObj, mask.nativeObj, min_confidence)));
- // return retVal;
- // }
- // //
- // // C++: void cv::text::OCRTesseract::setWhiteList(String char_whitelist)
- // //
- // public void setWhiteList(string char_whitelist)
- // {
- // ThrowIfDisposed();
- // text_OCRTesseract_setWhiteList_10(nativeObj, char_whitelist);
- // }
- // //
- // // C++: static Ptr_OCRTesseract cv::text::OCRTesseract::create(c_string datapath = 0, c_string language = 0, c_string char_whitelist = 0, int oem = OEM_DEFAULT, int psmode = PSM_AUTO)
- // //
- // /**
- // * Creates an instance of the OCRTesseract class. Initializes Tesseract.
- // *
- // * param datapath the name of the parent directory of tessdata ended with "/", or NULL to use the
- // * system's default directory.
- // * param language an ISO 639-3 code or NULL will default to "eng".
- // * param char_whitelist specifies the list of characters used for recognition. NULL defaults to ""
- // * (All characters will be used for recognition).
- // * param oem tesseract-ocr offers different OCR Engine Modes (OEM), by default
- // * tesseract::OEM_DEFAULT is used. See the tesseract-ocr API documentation for other possible
- // * values.
- // * param psmode tesseract-ocr offers different Page Segmentation Modes (PSM) tesseract::PSM_AUTO
- // * (fully automatic layout analysis) is used. See the tesseract-ocr API documentation for other
- // * possible values.
- // *
- // * <b>Note:</b> The char_whitelist default is changed after OpenCV 4.7.0/3.19.0 from "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" to "".
- // * return automatically generated
- // */
- // public static OCRTesseract create(string datapath, string language, string char_whitelist, int oem, int psmode)
- // {
- // return OCRTesseract.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(text_OCRTesseract_create_10(datapath, language, char_whitelist, oem, psmode)));
- // }
- // /**
- // * Creates an instance of the OCRTesseract class. Initializes Tesseract.
- // *
- // * param datapath the name of the parent directory of tessdata ended with "/", or NULL to use the
- // * system's default directory.
- // * param language an ISO 639-3 code or NULL will default to "eng".
- // * param char_whitelist specifies the list of characters used for recognition. NULL defaults to ""
- // * (All characters will be used for recognition).
- // * param oem tesseract-ocr offers different OCR Engine Modes (OEM), by default
- // * tesseract::OEM_DEFAULT is used. See the tesseract-ocr API documentation for other possible
- // * values.
- // * (fully automatic layout analysis) is used. See the tesseract-ocr API documentation for other
- // * possible values.
- // *
- // * <b>Note:</b> The char_whitelist default is changed after OpenCV 4.7.0/3.19.0 from "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" to "".
- // * return automatically generated
- // */
- // public static OCRTesseract create(string datapath, string language, string char_whitelist, int oem)
- // {
- // return OCRTesseract.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(text_OCRTesseract_create_11(datapath, language, char_whitelist, oem)));
- // }
- // /**
- // * Creates an instance of the OCRTesseract class. Initializes Tesseract.
- // *
- // * param datapath the name of the parent directory of tessdata ended with "/", or NULL to use the
- // * system's default directory.
- // * param language an ISO 639-3 code or NULL will default to "eng".
- // * param char_whitelist specifies the list of characters used for recognition. NULL defaults to ""
- // * (All characters will be used for recognition).
- // * tesseract::OEM_DEFAULT is used. See the tesseract-ocr API documentation for other possible
- // * values.
- // * (fully automatic layout analysis) is used. See the tesseract-ocr API documentation for other
- // * possible values.
- // *
- // * <b>Note:</b> The char_whitelist default is changed after OpenCV 4.7.0/3.19.0 from "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" to "".
- // * return automatically generated
- // */
- // public static OCRTesseract create(string datapath, string language, string char_whitelist)
- // {
- // return OCRTesseract.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(text_OCRTesseract_create_12(datapath, language, char_whitelist)));
- // }
- // /**
- // * Creates an instance of the OCRTesseract class. Initializes Tesseract.
- // *
- // * param datapath the name of the parent directory of tessdata ended with "/", or NULL to use the
- // * system's default directory.
- // * param language an ISO 639-3 code or NULL will default to "eng".
- // * (All characters will be used for recognition).
- // * tesseract::OEM_DEFAULT is used. See the tesseract-ocr API documentation for other possible
- // * values.
- // * (fully automatic layout analysis) is used. See the tesseract-ocr API documentation for other
- // * possible values.
- // *
- // * <b>Note:</b> The char_whitelist default is changed after OpenCV 4.7.0/3.19.0 from "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" to "".
- // * return automatically generated
- // */
- // public static OCRTesseract create(string datapath, string language)
- // {
- // return OCRTesseract.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(text_OCRTesseract_create_13(datapath, language)));
- // }
- // /**
- // * Creates an instance of the OCRTesseract class. Initializes Tesseract.
- // *
- // * param datapath the name of the parent directory of tessdata ended with "/", or NULL to use the
- // * system's default directory.
- // * (All characters will be used for recognition).
- // * tesseract::OEM_DEFAULT is used. See the tesseract-ocr API documentation for other possible
- // * values.
- // * (fully automatic layout analysis) is used. See the tesseract-ocr API documentation for other
- // * possible values.
- // *
- // * <b>Note:</b> The char_whitelist default is changed after OpenCV 4.7.0/3.19.0 from "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" to "".
- // * return automatically generated
- // */
- // public static OCRTesseract create(string datapath)
- // {
- // return OCRTesseract.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(text_OCRTesseract_create_14(datapath)));
- // }
- // /**
- // * Creates an instance of the OCRTesseract class. Initializes Tesseract.
- // *
- // * system's default directory.
- // * (All characters will be used for recognition).
- // * tesseract::OEM_DEFAULT is used. See the tesseract-ocr API documentation for other possible
- // * values.
- // * (fully automatic layout analysis) is used. See the tesseract-ocr API documentation for other
- // * possible values.
- // *
- // * <b>Note:</b> The char_whitelist default is changed after OpenCV 4.7.0/3.19.0 from "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" to "".
- // * return automatically generated
- // */
- // public static OCRTesseract create()
- // {
- // return OCRTesseract.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(text_OCRTesseract_create_15()));
- // }
- //#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
- // const string LIBNAME = "__Internal";
- //#else
- // const string LIBNAME = "opencvforunity";
- //#endif
- // // C++: String cv::text::OCRTesseract::run(Mat image, int min_confidence, int component_level = 0)
- // [DllImport(LIBNAME)]
- // private static extern IntPtr text_OCRTesseract_run_10(IntPtr nativeObj, IntPtr image_nativeObj, int min_confidence, int component_level);
- // [DllImport(LIBNAME)]
- // private static extern IntPtr text_OCRTesseract_run_11(IntPtr nativeObj, IntPtr image_nativeObj, int min_confidence);
- // // C++: String cv::text::OCRTesseract::run(Mat image, Mat mask, int min_confidence, int component_level = 0)
- // [DllImport(LIBNAME)]
- // private static extern IntPtr text_OCRTesseract_run_12(IntPtr nativeObj, IntPtr image_nativeObj, IntPtr mask_nativeObj, int min_confidence, int component_level);
- // [DllImport(LIBNAME)]
- // private static extern IntPtr text_OCRTesseract_run_13(IntPtr nativeObj, IntPtr image_nativeObj, IntPtr mask_nativeObj, int min_confidence);
- // // C++: void cv::text::OCRTesseract::setWhiteList(String char_whitelist)
- // [DllImport(LIBNAME)]
- // private static extern void text_OCRTesseract_setWhiteList_10(IntPtr nativeObj, string char_whitelist);
- // // C++: static Ptr_OCRTesseract cv::text::OCRTesseract::create(c_string datapath = 0, c_string language = 0, c_string char_whitelist = 0, int oem = OEM_DEFAULT, int psmode = PSM_AUTO)
- // [DllImport(LIBNAME)]
- // private static extern IntPtr text_OCRTesseract_create_10(string datapath, string language, string char_whitelist, int oem, int psmode);
- // [DllImport(LIBNAME)]
- // private static extern IntPtr text_OCRTesseract_create_11(string datapath, string language, string char_whitelist, int oem);
- // [DllImport(LIBNAME)]
- // private static extern IntPtr text_OCRTesseract_create_12(string datapath, string language, string char_whitelist);
- // [DllImport(LIBNAME)]
- // private static extern IntPtr text_OCRTesseract_create_13(string datapath, string language);
- // [DllImport(LIBNAME)]
- // private static extern IntPtr text_OCRTesseract_create_14(string datapath);
- // [DllImport(LIBNAME)]
- // private static extern IntPtr text_OCRTesseract_create_15();
- // // native support for java finalize()
- // [DllImport(LIBNAME)]
- // private static extern void text_OCRTesseract_delete(IntPtr nativeObj);
- // }
- //}
- //#endif
|