Here is an example that used Image to display a filtered OpenCV stream on an image.
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.image import Image
from kivy.clock import Clock
from kivy.graphics.texture import Texture
import cv2 as cv
class CamApp(App):
def build(self):
self.img1 = Image()
layout = BoxLayout()
layout.add_widget(self.img1)
self.capture = cv.VideoCapture(0)
Clock.schedule_interval(self.update, 1.0 / 33.0)
return layout
def update(self, dt):
# display image from cam in opencv window
ret, frame = self.capture.read()
gray= cv.cvtColor(frame, cv.COLOR_BGR2GRAY)
# convert it to texture
adaptive_thresh = cv.adaptiveThreshold(gray, 255, cv.ADAPTIVE_THRESH_MEAN_C, cv.THRESH_BINARY, 11, 3)
buf = cv.flip(adaptive_thresh, 0).tobytes()
texture1 = Texture.create(size=(adaptive_thresh.shape[1], adaptive_thresh.shape[0]), colorfmt='luminance')
texture1.blit_buffer(buf, colorfmt='luminance', bufferfmt='ubyte')#replacing texture
# display image from the texture
self.img1.texture = texture1
if __name__ == '__main__':
CamApp().run()
cv.destroyAllWindows()
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/d134f2a6-2675-4c8f-888a-4ebbc22867e3n%40googlegroups.com.
I have not done any Android development. You may find this helpful: https://github.com/Android-for-Python/Android-for-Python-Users#camera
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/e518377e-11f4-4e9f-b157-5f87b3476763n%40googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "Kivy users support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kivy-users/_1EP1z-Oe_Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/e39a6429-72fd-4eaf-98ec-8aac3fb47861n%40googlegroups.com.