Git Product home page Git Product logo

Comments (3)

davidplowman avatar davidplowman commented on June 19, 2024

These are runtime controls and so they apply to particular images from the camera. The trouble is that there's quite a long pipeline between sending values, the camera or ISP seeing them, doing something about them, and then you getting frames back which reflect them (and are all sat in a queue waiting to be read).

If you want to monitor the settings every second, for example, you could do

from picamera2 import Picamera2
import time

picam2 = Picamera2()
picam2.configure(picam2.preview_configuration())
picam2.start()
while True:
    time.sleep(1)
    print(picam2.capture_metadata())

You can also capture an entire "request" which includes all the images and settings from the camera, for example you'd amend the example above with

while True:
    time.sleep(1)
    request = picam2.capture_request()
    image = request.make_array("main")  # this is the image from the "main" stream
    metadata = request.get_metadata()  # this is the metadata which applies to all images in the request
    request.release()  # requests must always be returned to the camera system!

Picamera2 itself doesn't keep track of all the most recent values you sent. If that's what you wanted, you'd have to do it yourself:

last_controls_sent = last_controls_sent | controls_being_sent_now

Hope that helps!

from picamera2.

shineworld avatar shineworld commented on June 19, 2024

Help was appreciated!

I'm converting an already existing IP camera based on raspberry, which went from USB camera device
and OpenCV: cap=cv2.VideoCapture() to a native raspberry Aducam B0393 with motorized focus.

I'm new to PiCamera2 and overall in libcamera lib so I need to learn step by step how to migrate
the old cap.get(prop_id) cap.set(prop_id, value) to PiCamera2 framework.

I don't need to read continuously the cap properties but:

  • start the camera (I guess there are always default values for Contrast, Brightness, etc).
  • get the oldest settings from a JSON file.
  • get the current cap (camera controls states)
  • apply only different values to camera.set_controls(controls)

Then when a cap (camera controls states) is necessary to change (human activity on UI)
change the camera control and eventually get active value to confirm the change.

from picamera2.

shineworld avatar shineworld commented on June 19, 2024

Solved keeping local dict of applied properties

from picamera2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.