EnoxSoftware / OpenCVForUnity

OpenCV for Unity (Untiy Asset Plugin)
https://assetstore.unity.com/packages/tools/integration/opencv-for-unity-21088
556 stars 174 forks source link

Text module/namespace not available for UWP #32

Open gerwalk opened 5 years ago

gerwalk commented 5 years ago

I need to perform OCR text recognition on a HoloLens. So I'm building a UWP app with the HoloToolkit and the HoloLensCameraStream package, followed along with your HoloLens example scenes to ensure things were building and running, but then when it came time for me to start writing OCR code, I discovered all of the classes in org/opencv_contrib/text are surrounded by #if !UNITY_WSA_10_0 which means that entire namespace is inaccessible.

What's the reason for this? I commented out that #if statement on all 9 of the files currently in the text folder and everything appears to compile and export just fine.

If there's a specific reason for excluding the text detection module in UWP/WSA builds, I think you should provide documentation for which specific modules are available under which runtime platforms, which isn't something I've found and I purchased this plugin with the understanding that it fully supported UWP (as I had no reason to suspect "partial" support).

Otherwise, please add text/OCR support to UWP/WSA builds.

EnoxSoftware commented 5 years ago

The dnn and text modules are not supported on the UWP platform. https://enoxsoftware.com/opencvforunity/documentation/support-modules/

The dnn module is disabled for builds for the UWP platform, so text modules that depend on the dnn module is also disabled. https://github.com/opencv/opencv/blob/master/modules/dnn/CMakeLists.txt#L1-L3 https://github.com/opencv/opencv_contrib/blob/master/modules/text/CMakeLists.txt#L2

gerwalk commented 5 years ago

What about Tesseract OCR? It doesn't depend on dnn. https://docs.opencv.org/3.4/d7/ddc/classcv_1_1text_1_1OCRTesseract.html

Edit: Sorry, I noticed after I posted this comment the footnote on your page saying Tesseract is not supported. If you don't mind, can you explain why? I'm curious if it's a technical limitation on opencv's end or if this is something that could actually be implemented, even if we have to write our own solution. It's been a challenge finding a Unity-friendly opencv implementation that provides all the features we need on Hololens........

joaocc commented 5 years ago

@EnoxSoftware Could you please confirm if the lack of support for DNN on UWP is due to it being amiss in OpenCV or some reason related to EnoxSoftware? Thx

EnoxSoftware commented 5 years ago

@gerwalk Please see the issue page below. https://github.com/opencv/opencv/issues/9177 The DNN module does not work properly on UWP.