Hi Robert.
Thanks for your answer.
I commented the resolution line in the kv string because otherwise the app crashes before I can see the UI. I saw this happens to others on some forum, and indeed, removing the resolution line makes it start, and i can press the Start button (giving a wrongly formatted video).
The error output is pretty long when it crashes.
Starting with about 6 warning 0:
[ WARN:0] global D:\a\opencv-python\opencv-python\opencv\modules\videoio\src\cap_msmf.cpp (696) CvCapture_MSMF::initStream Failed to set mediaType (stream 0, (640x480 @ 29.97) MFVideoFormat_RGB24(unsupported media type)
and 2 warning 1:
[ WARN:1] global D:\a\opencv-python\opencv-python\opencv\modules\videoio\src\cap_msmf.cpp (376) `anonymous-namespace'::SourceReaderCB::OnReadSample videoio(MSMF): OnReadSample() is called with error status: -1072875772
[ WARN:1] global D:\a\opencv-python\opencv-python\opencv\modules\videoio\src\cap_msmf.cpp (388) `anonymous-namespace'::SourceReaderCB::OnReadSample videoio(MSMF): async ReadSample() call is failed with error status: -1072875772
Than it starts like that :
Traceback (most recent call last):
File "C:\Users\Cedric\Documents\GIT\venv\lib\site-packages\kivy\lang\builder.py", line 705, in _apply_rule
setattr(widget_set, key, value)
File "kivy\weakproxy.pyx", line 35, in kivy.weakproxy.WeakProxy.__setattr__
File "kivy\properties.pyx", line 498, in kivy.properties.Property.__set__
File "kivy\properties.pyx", line 840, in kivy.properties.ListProperty.set
File "kivy\properties.pyx", line 545, in kivy.properties.Property.set
File "kivy\properties.pyx", line 600, in kivy.properties.Property.dispatch
File "kivy\_event.pyx", line 1248, in kivy._event.EventObservers.dispatch
File "kivy\_event.pyx", line 1154, in kivy._event.EventObservers._dispatch
File "C:\Users\Cedric\Documents\GIT\venv\lib\site-packages\kivy\uix\camera.py", line 104, in _on_index
resolution=self.resolution, stopped=True)
File "C:\Users\Cedric\Documents\GIT\venv\lib\site-packages\kivy\core\camera\camera_opencv.py", line 70, in __init__
super(CameraOpenCV, self).__init__(**kwargs)
File "C:\Users\Cedric\Documents\GIT\venv\lib\site-packages\kivy\core\camera\__init__.py", line 70, in __init__
self.init_camera()
File "C:\Users\Cedric\Documents\GIT\venv\lib\site-packages\kivy\core\camera\camera_opencv.py", line 120, in init_camera
self._resolution = (int(frame.shape[1]), int(frame.shape[0]))
AttributeError: 'NoneType' object has no attribute 'shape'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/Cedric/Documents/GIT/ik_python/Products/Various/TestKivyCamera.py", line 61, in <module>
TestCamera().run()
File "C:\Users\Cedric\Documents\GIT\venv\lib\site-packages\kivy\app.py", line 949, in run
self._run_prepare()
File "C:\Users\Cedric\Documents\GIT\venv\lib\site-packages\kivy\app.py", line 919, in _run_prepare
root = self.build()
File "C:/Users/Cedric/Documents/GIT/ik_python/Products/Various/TestKivyCamera.py", line 58, in build
return CameraClick()
File "C:\Users\Cedric\Documents\GIT\venv\lib\site-packages\kivy\uix\boxlayout.py", line 145, in __init__
super(BoxLayout, self).__init__(**kwargs)
File "C:\Users\Cedric\Documents\GIT\venv\lib\site-packages\kivy\uix\layout.py", line 76, in __init__
super(Layout, self).__init__(**kwargs)
File "C:\Users\Cedric\Documents\GIT\venv\lib\site-packages\kivy\uix\widget.py", line 361, in __init__
rule_children=rule_children)
File "C:\Users\Cedric\Documents\GIT\venv\lib\site-packages\kivy\uix\widget.py", line 465, in apply_class_lang_rules
rule_children=rule_children)
File "C:\Users\Cedric\Documents\GIT\venv\lib\site-packages\kivy\lang\builder.py", line 543, in apply
rule_children=rule_children)
File "C:\Users\Cedric\Documents\GIT\venv\lib\site-packages\kivy\lang\builder.py", line 712, in _apply_rule
e), cause=tb)
kivy.lang.builder.BuilderException: Parser: File "<inline>", line 6:
...
4: Camera:
5: id: camera
>> 6: resolution: (640, 480)
7: index: 0
8: play: False
...
AttributeError: 'NoneType' object has no attribute 'shape'
...
If you think it's worth it I can include the full output.
Thank you.