Search code examples
pythonreal-timeocr

Python real time screen processing


I would like to process my screen in a real time.
Is there some real time OCR library for python, that I could use?
Or is there some better technology that I could use?


Solution

  • In VLC, go to Media -> Stream -> Capture Device, select Desktop and create the stream. Create a HTTP stream.

    Then use OpenCV to open the stream and use something like this:

    cv::VideoCapture vcap;
    if(!vcap.open(videoStreamAddress)) {
        std::cout << "Error opening video stream or file" << std::endl;
        return -1;
    }
    cv::namedWindow("Output Window");
    
    while (true) {
        if(!vcap.read(image)) {
            std::cout << "No frame" << std::endl;
            cv::waitKey();
        }
        //Process image here
    }
    

    Sorry it's C++ not Python but you can do the same thing in Python easily.

    Disclaimer: I have not tested this myself, it is just an idea