Integrate OpenCV webcam into a Kivy user interface
<p>My current program is in Python and uses OpenCV. I rely on webcam captures and I am processing every captured frame:</p>

<pre><code>import cv2

# use the webcam
cap = cv2.VideoCapture(0)
while True:
    # read a frame from the webcam
    ret, img = cap.read()
    # transform image
</code></pre>

<p>I would like to make a Kivy interface (or another graphical user interface) with buttons, keeping already existing  functionality with webcam captures.</p>

<p>I found this example: 
<a href="https://kivy.org/docs/examples/gen__camera__main__py.html" rel="noreferrer">https://kivy.org/docs/examples/gen__camera__main__py.html</a> 
 — but it doesn’t explain how to acquire the webcam image to process it with OpenCV.</p>

<p>I found an older example:
<a href="http://thezestyblogfarmer.blogspot.it/2013/10/kivy-python-script-for-capturing.html" rel="noreferrer">http://thezestyblogfarmer.blogspot.it/2013/10/kivy-python-script-for-capturing.html</a>
— it saves screenshots to disk using the ‘screenshot’ function. Then I can read the saved files and process them, but this seems to be an unnecessary step.</p>

<p>What else can I try?</p>