RPi zero 2 picamera

This forum is for topics dealing with problems with software specifically in the AArch64 repo.

RPi zero 2 picamera

Postby unformatted » Fri Mar 18, 2022 1:36 pm

I've installed AArch64 on a raspberry pi zero 2 and replaced the kernel with linux-rpi since I need GPIO access.

$this->bbcode_second_pass_code('', '
[user@PC19 ~]$ uname -a
Linux PC19 5.15.28-2-rpi-ARCH #1 SMP PREEMPT Wed Mar 16 20:29:17 UTC 2022 aarch64 GNU/Linux
')
I installed picamera from python since I need to access my raspberry pi camera module. However running the following script

$this->bbcode_second_pass_code('', '
#/usr/bin/env python

import picamera
import time

camera = picamera.PiCamera()

try:
camera.start_preview()
time.sleep(2)
camera.capture("/home/user/cameratest.jpg")

except Exception as error:
print(error)

finally:
camera.stop_preview()
camera.close()
')
gives me the following error:

$this->bbcode_second_pass_code('', '
[user@PC19 ~]$ python test_camera.py
Traceback (most recent call last):
File "/home/user/test_camera.py", line 3, in <module>
import picamera
File "/usr/lib/python3.10/site-packages/picamera/__init__.py", line 72, in <module>
from picamera.exc import (
File "/usr/lib/python3.10/site-packages/picamera/exc.py", line 41, in <module>
import picamera.mmal as mmal
File "/usr/lib/python3.10/site-packages/picamera/mmal.py", line 49, in <module>
_lib = ct.CDLL('libmmal.so')
File "/usr/lib/python3.10/ctypes/__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libmmal.so: cannot open shared object file: No such file or directory
')

This used to run fine on my old pi zero which was runnin armv6. Here's my config.txt which is the same as on my old pi zero:

$this->bbcode_second_pass_code('', '
[user@PC19 ~]$ cat /boot/config.txt
# See /boot/overlays/README for all available options

initramfs initramfs-linux.img followkernel

gpu_mem=128
temp_limit=70
hdmi_blanking=1
#dtoverlay=disable-wifi
dtoverlay=disable-bt
start_file=start_x.elf
fixup_file=fixup_x.dat
disable_camera_led=1
')
Any ideas why this is not working?
unformatted
 
Posts: 119
Joined: Tue Mar 09, 2021 5:23 pm

Re: RPi zero 2 picamera

Postby jesseF » Thu Mar 24, 2022 2:08 pm

so, I was going to say that I had the same issue, but I looked at your config and rearranged mine a bit and it works now! I am running the standard ArchLinuxARM-rpi-armv7-latest.tar.gz install as I was unable to get the aarch64 one to work.
anyway, here's my /boot/config.txt:
$this->bbcode_second_pass_code('', '
# See /boot/overlays/README for all available options

initramfs initramfs-linux.img followkernel

gpu_mem=128
start_file=start_x.elf
fixup_file=fixup_x.dat
dtoverlay=vc4-kms-v3d
dtoverlay=disable-bt

# Uncomment to enable bluetooth
#dtparam=krnbt=on

[pi4]
# Run as fast as firmware / board allows
arm_boost=1
')
Hope this helps!
jesseF
 
Posts: 24
Joined: Mon Jun 15, 2020 3:36 am

Re: RPi zero 2 picamera

Postby unformatted » Thu Mar 24, 2022 4:45 pm

Thanks for responding but the issue is on armv8 using the linux-rpi kernel.
unformatted
 
Posts: 119
Joined: Tue Mar 09, 2021 5:23 pm

Re: RPi zero 2 picamera

Postby robg » Fri Mar 25, 2022 11:53 am

I am not running picamera myself, but could your issue be due to this?
robg
 
Posts: 186
Joined: Tue Jan 05, 2021 8:22 am

Re: RPi zero 2 picamera

Postby unformatted » Fri Mar 25, 2022 2:35 pm

It is. With the current linux-rpi kernel you now have to install libcamera which is available on AUR but that's not building for me. You also have to build some basic modules according raspberry pi blog and in the end there are no python bindings available (yet). So at the moment it is quite difficult to get libcamera or picamera on aarch64 with linux-rpi kernel.
unformatted
 
Posts: 119
Joined: Tue Mar 09, 2021 5:23 pm

Re: RPi zero 2 picamera

Postby unformatted » Thu May 26, 2022 8:56 am

It seems picamer2 is available for a while now, but you also need to install various packages in addition to picamer2 (https://pypi.org/project/picamera2/ ). It is still a work in progress and not stable yet.

Meanwhile I started looking for an alternative and decided to use opencv. That's been around for quite a while, has a huge user base and therefore I expect it to be around for many years to come. Accessing and using a camera is not as straightforward as with picamera but for me the big bonus is that it also works with usb cameras, not only the pi camera module.

I'm now able to take pictures, record video and stream from both pi camera module and various usb cameras (webcams). This is ideal for my remote camera and robot projects using RPi zero 2.

Since these RPi zero 2's run headless I installed opencv-python-headless (https://pypi.org/project/opencv-python/).
unformatted
 
Posts: 119
Joined: Tue Mar 09, 2021 5:23 pm


Return to ARMv8

Who is online

Users browsing this forum: No registered users and 9 guests