Search code examples
pythonc#opencvtesseractcpython

Does CPython Enables Import of OpenCV and Tesseract-OCR in C# In Windows 10?


I'm trying to do simple OCR .Net program using C# in Windows 10 without using Visual Studio. What i did is using ironpython + python script. I've managed to pass bitmap data into a python script and output it. However, when i tried to process it using OpenCV and Tesseract-OCR, ironpython fail to import opencv and pytesseract ( this is just a guess ) and further research about ironpython made me realize it doesn't support both of it.

Currently, i'm trying to switch to Cpython.

My questions is:

  1. Does Cpython support import of OpenCV and Pytesseract for python file?
  2. Or is there a more elegant and simple method for OCR using C#, with the help of OpenCV and Tesseract-OCR in Windows 10 without using Visual Studio?

Solution

  • Does Cpython support import of OpenCV and Pytesseract for python file

    I have no idea.

    Or is there a more elegant and simple method for OCR using C#, with the help of OpenCV and Tesseract-OCR in Windows 10 without using Visual Studio?

    You can use OpenCV directly in c#, either with p/Invoke or with a wrapper like emguCV. The situation with Tesseract seem to be similar. I fail to see what Python would add, except added complexity.

    It is really unclear what you mean with "without using Visual Studio". Visual studio contains a bunch of different things:

    1. The visual studio code editor
    2. c# compiler and other build-tools
    3. Microsoft C and C++ (MSVC) runtime libraries, aka vcredist

    There is no need at all to use the visual studio editor, feel free to code in notepad if you want to. But you cannot really write c# programs without at least the c# compiler and the .net runtime, and you probably want to use at least some of the associated build tools. The potential MSVC runtime dependency is due to the native library, and does not really have anything to do with C#.