Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Live View -> end with a "normal" Capture #247

Open
TilmanBrugger opened this issue Mar 16, 2018 · 0 comments
Open

Live View -> end with a "normal" Capture #247

TilmanBrugger opened this issue Mar 16, 2018 · 0 comments

Comments

@TilmanBrugger
Copy link

Hi Guys,

i am looking for help.
I use libgphoto2. I try to make a live view and a Image Capture in time, at the end. My Problem is between live view and capture. It need round about 2 sec. to shot a picture.
Can everyone help my, how can i implement?


class camera(object):

def __init__(self):
    logging.basicConfig(format='%(levelname)s:%(name)s:%(message)s', level=logging.WARNING)
    gp.check_result(gp.use_python_logging())
    self.camera = gp.check_result(gp.gp_camera_new())
    gp.check_result(gp.gp_camera_init(self.camera))

def get_camera(self):
    return self.kamera

def capture(self):
    bild_path = gp.check_result(gp.gp_camera_capture(self.camera, gp.GP_CAPTURE_IMAGE))

    kamera_file = gp.check_result(
        gp.gp_camera_file_get(self.kamera, bild_path.folder, bild_path.name, gp.GP_FILE_TYPE_NORMAL))
    target = os.path.join('/tmp', bild_path.name)

    gp.check_result(gp.gp_file_save(kamera_file, target))
    # print(str(target))
    return Image.open(target)

def statuscamera(self):
    return True

def startLiveView(self):
    self.camera_file = gp.check_result(gp.gp_camera_capture_preview(self.camera))

    file_data = gp.check_result(gp.gp_file_get_data_and_size(self.camera_file))
    # display image
    data = memoryview(file_data)

    image = Image.open(io.BytesIO(file_data))
    # self.lastPicture=image

    return image

def killStream(self):
    gp.gp_camera_exit(self.camera)

cameraObject = camera()

i=10
while i<1:
cameraObject.startLiveView()
i=i-1
cameraObject.capture()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant