Camera.texture.save() just a black.jpg

58 views
Skip to first unread message

goshfather

unread,
May 22, 2016, 10:37:22 PM5/22/16
to Kivy users support
below is a simple .apk that im putting together. It works great on my win laptop. it takes a picture and saves it to a dir as a .jpg. However when i build the .apk and run it on android, it does the exact same thing except the .jpg that it shoots out is just solid black. Im guessing I have trouble accessing the buffer?



from kivy.app import App
from kivy.clock import Clock

from kivy.uix.scatterlayout import ScatterLayout
from kivy.core.camera import Camera

def snap(*args):
  cam.texture.save("/storage/emulated/0/DCIM/TestPic.jpg") #!! Win/Android


class TestCamera(App):
    def build(self):
    blank = ScatterLayout()
    global cam
    cam = Camera(resolution = (640, 480), play = True)
    Clock.schedule_once(snap, 5)
        return blank

TestCamera().run()

goshfather

unread,
May 22, 2016, 11:56:53 PM5/22/16
to Kivy users support
Turns out the room was just dark......jk lol just kidding. I manually set the camera index and it worked

Rafael Lima

unread,
Jun 22, 2016, 3:06:25 AM6/22/16
to Kivy users support
Hi goshfather how did you set the index of the camera ? index = 1 or something like that?
I have the same black screen problem

Rafael Lima

unread,
Jun 22, 2016, 2:22:22 PM6/22/16
to Kivy users support
I tryed to run your code and I got an error with this Camera class from kivy.core, it's not instantiating 
Could you help me ? 

Regards
Reply all
Reply to author
Forward
0 new messages