Cannot get image texture to display (OpenCV + Kivy)

14 views
Skip to first unread message

Jonathan Piat

unread,
Dec 4, 2017, 5:08:24 AM12/4/17
to Kivy users support
Hi,

i'am creating a kivy app to display OpenCV images acquired in a robotic framework (ROS). The following code display an image in the openCv window but the kivy image stays blank. I have tried examples that displays an image acquired from a webcam using OpenCv and they work so i have no clue of what i do wrong :

     def populate_texture(self, dt):
       
print 'calling update '
       
try:
           
if not self.frame_queue.empty() :
               
print 'Queue not empty'
                img
= self.frame_queue.get()
                cv2
.imshow('img', img)
                cv2
.waitKey(1)
                image_texture
= Texture.create(size=(img.shape[1], img.shape[0]), colorfmt='bgr')
                image_texture
.blit_buffer(img.tostring(), colorfmt='bgr', bufferfmt='ubyte')
               
self.subject_picture.texture = image_texture
               
self.subject_picture.do_layout()
       
except:
            traceback
.print_exc()


Reply all
Reply to author
Forward
0 new messages