IMX477 camera blurry beyond 40cm with LN016 lens on Jetson Orin Nano

Hi, I’ve got an Arducam B0273 (IMX477 12MP High Quality Camera with motorized focus/autofocus, Arducam 12MP IMX477 Motorized Focus High Quality Camera for Jetson Nano/Xavier NX) and a Jetson Orin Nano Developer Kit. Can I use the Picamera library with this camera on the Orin Nano, or is there a similar library I should use instead? Not sure where to start with this combo.

For the Jetson you’ll want Picamera2 rather than the old Picamera library. There are working examples here: GitHub - ArduCAM/picamera2_examples · GitHub and a Jetson quick-start guide with a section specifically for the IMX477 motorized focus camera: Quick start - Arducam Wiki . What are you trying to capture? That’ll help with lens and focus advice.

I also got the LN016 lens for it (M12 mount, 25mm focal length). The image is kind of ‘too focused’ - if the object isn’t at exactly the right distance it just gets blurred. I need more depth of focus and a bit higher field of view. Which LN lens should I switch to? And what’s the spec of the original lens that ships on the B0273?

A 25mm lens on this sensor gives a narrow field of view and shallow depth of field, so that behavior sounds expected. To recommend the right LN number I need to know your working distance and the size of details you need to resolve. Also, which Jetpack/L4T are you running, and which demo script are you using right now?

I’m trying to capture small surface scratches (~1mm) from around 30cm, and also read datamatrix/text from about 1m away. At ~25cm the resolution is good, but past 40cm it’s bad. I don’t need a very wide FOV, just high resolution at ~1m. I flashed Jetpack 6.0 and the camera/driver is working. I’ve been testing with the demo code in ~/MIPI_Camera/Jetson/IMX477/AF_LENS and using FocuserExample.py to adjust focus.

At 1m the focus position gets very sensitive, so that matches the blur you’re seeing. Can you post a screenshot of the output format/resolution you’re getting, and tell me exactly how you run the script? Also try it once with sudo and once without, and tell me what each does.

Here’s the output format/resolution:

image003.png

When I run python3 JetsonCamera.py without sudo it fails with ‘camera cannot be open’. With sudo python3 JetsonCamera.py it works. Any idea why? Also, how do I control the shutter speed? Is there documentation for the camera control libraries?

The sudo vs non-sudo difference is almost always device-node permissions - the video and i2c nodes need to be accessible to your user. The demo folder has Autofocus.py, Focuser.py, JetsonCamera.py and FocuserExample.py, and the shutter/exposure controls are exposed through those. The quick-start guide covers the control options. Can you run ./install_full.sh -m imx477 and paste the full output? That will tell us if it found the right package for your kernel.

Quick side question while I’m here - does the Arducam IMX519 autofocus module (B0371, https://www.arducam.com/product/imx519-autofocus-camera-module-for-raspberry-pi-arducam-b0371/) support the Jetson Orin Nano? My current environment: Jetpack 6.0 / L4T 36.3.0, kernel 5.10.192-tegra-35.5.0-20240613202628.

Here are the quality comparisons: at ~25cm (good) image004.jpg and at >40cm (bad) image005.jpg.

Device photos: image006.png

Jetson info: image007.png

Thanks for the samples - the 25cm shot is clearly sharper than the 40cm+ one, which fits the shallow depth of field at that distance. The IMX519 is a separate module and its Jetson support needs to be checked on its own, so let’s finish the IMX477 first. Did you get a chance to run ./install_full.sh -m imx477? Paste the full output.

Yes, here it is:

user@ubuntu:~/Downloads$ ./install_full.sh -m imx477
./install_full.sh: line 19: warning: command substitution: ignored null byte in input
NVIDIA Orin Nano Developer Kit
--2024-07-18 21:31:40--  https://github.com/ArduCAM/MIPI_Camera/releases/download/v0.0.3/imx477_links.txt
Resolving github.com (github.com)... 140.82.121.4
Connecting to github.com (github.com)|140.82.121.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/... [following]
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.111.133, 185.199.108.133, 185.199.109.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.111.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 17678 (17K) [application/octet-stream]
Saving to: 'imx477_links.txt'
imx477_links.txt 100%[=============================>] 17.26K --.-KB/s in 0.003s
2024-07-18 21:31:41 (6.23 MB/s) - 'imx477_links.txt' saved [17678/17678]
Cannot find the corresponding deb package, please send the following information to [email protected]
Kernel version:  5.10.192-tegra-35.5.0-20240613202628
Jetson type:  NVIDIA Orin Nano Developer Kit
(Earlier run reported: Jetson type: UNKNOWN)

So a couple of things from that output: the installer couldn’t find a matching deb package for your kernel build (5.10.192-tegra-35.5.0-20240613202628), and the earlier run printed ‘Jetson type: UNKNOWN’, so board detection failed before the download on that attempt. Since your camera and demo code are already working, the current setup is to use the Picamera2 examples (GitHub - ArduCAM/picamera2_examples · GitHub) and follow the IMX477 motorized focus camera section of the Jetson quick-start guide (Quick start - Arducam Wiki) for focus, shutter and exposure control. The lens/depth-of-field issue at 1m is still open - the 25mm LN016 is most likely the limiting factor - but for the original library question, Picamera2 + that guide is the right path.