[BUG] LensPosition must be set to 4 in manual focus for "Infinity"

Open
#1,098 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
python, raspberry-pi
Domain
embedded-iot

Research direction

Start by reproducing the reported behavior with the supplied Python test program on a Raspberry Pi Zero 2 W with the Raspberry camera v3, and inspect the reported LensPosition metadata for manual focus values. Done means the manual-focus setting and the documented or observed infinity position agree, with the behavior verified across the relevant lens-position range.

Written by the indexing model from the issue text.

Description

The manual focus is not "Infinity" when LensPosition is set to 0.0.
With LensPosition between 0 and 3, the horizon is blurred, it is clear when LensPosition = 4

My hardware is : Raspberry Pi Zero 2 W + Raspberry camera v3 (wide 120°)

Here is the test program:

import libcamera
import time
from picamera2 import Picamera2
picam2 = Picamera2()
picam2.configure(picam2.create_still_configuration())
picam2.start()

for lens_position in range(35):
    picam2.set_controls({"AfMode": libcamera.controls.AfModeEnum.Manual, "LensPosition": lens_position})
    time.sleep(1)
    r = picam2.capture_request()
    filename = "lens-position" + str(lens_position) + ".jpg"
    metadata = r.get_metadata()
    actual_lens_position = metadata["LensPosition"]
    print("Actual LensPosition = {}, file capture in file {}".format(actual_lens_position,filename))
    r.save("main", filename)
    r.release()

picam2.stop()
Dominant language
Python
Stars
1.2k
Forks
258
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from raspberrypi/picamera2

All issues in raspberrypi/picamera2

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.