3

I've been trying to make an app that opens the device's camera but I get this error:

    [CRITICAL          ] [Camera      ] Unable to find any valuable Camera provider at all!
videocapture - ImportError: No module named VideoCapture
  File "C:\Users\Gaston\Downloads\Kivy-1.9.0-py2.7-win32-x86\kivy27\kivy\core\__init__.py", line 57, in core_select_lib
    fromlist=[modulename], level=0)
  File "C:\Users\Gaston\Downloads\Kivy-1.9.0-py2.7-win32-x86\kivy27\kivy\core\camera\camera_videocapture.py", line 15, in <module>
    from VideoCapture import Device

opencv - ImportError: No module named cv
  File "C:\Users\Gaston\Downloads\Kivy-1.9.0-py2.7-win32-x86\kivy27\kivy\core\__init__.py", line 57, in core_select_lib
    fromlist=[modulename], level=0)
  File "C:\Users\Gaston\Downloads\Kivy-1.9.0-py2.7-win32-x86\kivy27\kivy\core\camera\camera_opencv.py", line 20, in <module>
    import cv

Tried to install opencv but still not working. My code is the same code example in kivy's docs:

from kivy.app import App
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
import time
Builder.load_string('''
<CameraClick>:
    orientation: 'vertical'
    Camera:
        id: camera
        resolution: (640, 480)
        play: False
    ToggleButton:
        text: 'Play'
        on_press: camera.play = not camera.play
        size_hint_y: None
        height: '48dp'
    Button:
        text: 'Capture'
        size_hint_y: None
        height: '48dp'
        on_press: root.capture()
''')


class CameraClick(BoxLayout):
    def capture(self):
        '''
        Function to capture the images and give them the names
        according to their captured time and date.
        '''
        camera = self.ids['camera']
        timestr = time.strftime("%Y%m%d_%H%M%S")
        camera.export_to_png("IMG_{}.png".format(timestr))
        print("Captured")


class TestCamera(App):

    def build(self):
        return CameraClick()


TestCamera().run()
adnanmuttaleb
  • 3,388
  • 1
  • 29
  • 46
gbarbero
  • 53
  • 1
  • 6
  • What platform are you running on? How have you tried to install opencv? Have you installed the python-opencv package? – Talia May 18 '15 at 03:02
  • @Collin I'm running Windows 7 Ultimate on an Intel based iMac, and yes I have installed opencv. However, went on doing some research and found out this http://stackoverflow.com/questions/4709301/installing-opencv-on-windows-7-for-python-2-7 Maybe Kivy uses the "opencv" binding instead of "cv" or "cv2" – gbarbero May 18 '15 at 13:35

0 Answers0