Working Camera Examples?

31 views
Skip to first unread message

driskel

unread,
Jun 15, 2018, 9:50:17 PM6/15/18
to MPF Users
I am trying to use the camera widget on the most recent release of MPF on a Mac Laptop.

When the slide is displayed I see the camera turn on as expected, I do not see the output of the camera on a slide.

Here is my test harness for just this:

#config_version=5

hardware
:
    platform
: p3_roc
    driverboards
: pdb
   
mpf
-mc:
    widgets
:
        camera
: mpfmc.widgets.camera

displays
:
    window
:
        width
: 1280
        height
: 720
             
window
:
    width
: 1280
    height
: 720
   
slide_player
:
   mc_ready
:
       camera
:
           target
: window    
                             
slides
:
    camera
:
        widgets
:
           
- type: camera
              width
: 1028
              height
: 720

driskel

unread,
Jun 15, 2018, 9:53:44 PM6/15/18
to MPF Users
I have tried using a window as well as a SmartMatrix (DMD) with the same result.

jabdoa

unread,
Jun 16, 2018, 7:37:01 AM6/16/18
to MPF Users
Do other widgets like images show up in your example? I guess they would so this is just to rule out problems in your test harness.

Do you need the mpf-mc section? Camera widget should be in there by default I suppose.

It might be actually broken. I'm not aware that somebody is actively using it. Brian wrote it as a proof of concept a while back.

You can try this kivy example: https://kivy.org/docs/examples/gen__camera__main__py.html to see if you camera works at all with kivy/SDL2.


Jan

driskel

unread,
Jun 16, 2018, 10:27:43 AM6/16/18
to MPF Users
I will test other examples.

In my tests, the mpf-mc section was required.  But I will try again.

Thank you.

driskel

unread,
Jun 16, 2018, 11:04:16 AM6/16/18
to MPF Users
I was just testing the camera functionality in my Proof of concepts machine.  So I do not have a pressing need for it.

Do other widgets like images show up in your example? Yes

Do you need the mpf-mc section? Camera widget should be in there by default I suppose.  Yes, otherwise this error occurs.

2018-06-16 10:00:20,525 : kivy : "camera" is not a valid MPF display widget type. Did you misspell it, or forget to enable it in the "mpf-mc: widgets" section of your machine config?
Traceback (most recent call last):
 
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/mpfmc/config_collections/widget.py", line 43, in process_widget
    widget_cls
= WidgetCollection.type_map[config['type']]
 
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/mpf/core/case_insensitive_dict.py", line 21, in __getitem__
   
return super().__getitem__(self.__class__.lower(key))
KeyError: 'camera'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
 
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/mpfmc/commands/mc.py", line 189, in __init__
    thread_stopper
=thread_stopper).run()
 
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/kivy/app.py", line 828, in run
    runTouchApp
()
 
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/kivy/base.py", line 504, in runTouchApp
   
EventLoop.window.mainloop()
 
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/kivy/core/window/window_sdl2.py", line 663, in mainloop
   
self._mainloop()
 
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/kivy/core/window/window_sdl2.py", line 405, in _mainloop
   
EventLoop.idle()
 
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/kivy/base.py", line 339, in idle
   
Clock.tick()
 
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/kivy/clock.py", line 581, in tick
   
self._process_events()
 
File "kivy/_clock.pyx", line 367, in kivy._clock.CyClockBase._process_events (/private/var/folders/5p/8kcfqh4s4f3776sdbb4_217h0000gn/T/pip-build-z3bue63m/kivy/kivy/_clock.c:7352)
 
File "kivy/_clock.pyx", line 397, in kivy._clock.CyClockBase._process_events (/private/var/folders/5p/8kcfqh4s4f3776sdbb4_217h0000gn/T/pip-build-z3bue63m/kivy/kivy/_clock.c:7229)
 
File "kivy/_clock.pyx", line 395, in kivy._clock.CyClockBase._process_events (/private/var/folders/5p/8kcfqh4s4f3776sdbb4_217h0000gn/T/pip-build-z3bue63m/kivy/kivy/_clock.c:7150)
 
File "kivy/_clock.pyx", line 167, in kivy._clock.ClockEvent.tick (/private/var/folders/5p/8kcfqh4s4f3776sdbb4_217h0000gn/T/pip-build-z3bue63m/kivy/kivy/_clock.c:3260)
 
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/mpfmc/uix/display.py", line 200, in _displays_initialized
   
self.mc.displays_initialized()
 
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/mpfmc/core/mc.py", line 336, in displays_initialized
   
self._init()
 
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/mpfmc/core/mc.py", line 360, in _init
   
self.events.process_event_queue()
 
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/mpf/core/events.py", line 729, in process_event_queue
   
**event[3])
 
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/mpf/core/events.py", line 698, in _process_event
    result
= self._run_handlers(event, ev_type, kwargs)
 
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/mpf/core/events.py", line 656, in _run_handlers
    result
= handler.callback(**merged_kwargs)
 
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/mpfmc/core/config_collection.py", line 50, in create_entries_from_root_config
   
self.create_entries(self.mc.machine_config[self.config_section])
 
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/mpfmc/core/config_collection.py", line 61, in create_entries
   
self[name] = self.process_config(settings)
 
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/mpfmc/config_collections/slide.py", line 33, in process_config
    config
['widgets'][i] = self.mc.widgets.process_widget(widget)
 
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/mpfmc/config_collections/widget.py", line 50, in process_widget
    config
['type']))
ValueError: "camera" is not a valid MPF display widget type. Did you misspell it, or forget to enable it in the "mpf-mc: widgets" section of your machine config?


jabdoa

unread,
Jun 16, 2018, 11:15:21 AM6/16/18
to MPF Users
Makes sense then. We probably never really included it then.

Do the kivy examples work? If yes this should be something simple.


Jan
Message has been deleted

driskel

unread,
Jun 16, 2018, 11:49:43 AM6/16/18
to MPF Users
Yes, the kivy example works for me.

I quickly assuming that maybe we are enabling the camera, but we are not playing what is on the camera

Here is a use case for the camera:

1) On high score, let someone pose in front of the camera, press the flipper to snap a photo and then retain the photo for use in displaying high scores.
2) On ball drain, show the players face :)
Reply all
Reply to author
Forward
0 new messages