You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Le Potato Board运行Raspbian时picamera报libbcm_host缺失错误求助

问题分析与解决建议

错误原因

OSError: libbcm_host: cannot open shared object file: No such file or directory 本质是**picamera库仅适配树莓派的Broadcom系列芯片**,它依赖Broadcom专属的libbcm_host库。而你的LePotato开发板采用Amlogic S905X芯片,没有该依赖库,因此无法运行基于picamera的代码。

解决步骤

1. 替换为兼容Amlogic平台的摄像头库

放弃picamera,改用支持多平台的libcamera(Linux平台摄像头官方标准方案),或Arducam针对LePotato提供的专用驱动库。

卸载旧库并安装libcamera

执行以下命令清理并安装兼容库:

pip uninstall -y picamera
sudo apt update
sudo apt install -y libcamera-tools python3-libcamera

安装Arducam多路适配器驱动

由于你使用Arducam多路摄像头适配器,需安装适配LePotato的专用驱动包(具体步骤可参考Arducam官方针对LePotato的多路摄像头配置说明)。

2. 修改代码适配libcamera API

原代码基于picamera的API完全不兼容,需要重写摄像头捕获逻辑。以下是适配后的核心代码示例(保留原GPIO多路切换逻辑):

import LePotatoPi.GPIO as gp
import time
import numpy as np
import cv2
from libcamera import Camera, CameraConfiguration

# 保留原GPIO配置、摄像头切换函数(configureMultiCamera、enableCamera、disableMultiCamera)不变

def capture(cam_num):
    # 配置摄像头
    with Camera() as camera:
        config = CameraConfiguration()
        config.size = (160, 112)
        config.format = 'RGB888'
        camera.configure(config)
        
        # 启动摄像头并等待稳定
        camera.start()
        time.sleep(0.5)
        
        # 捕获帧并转换为OpenCV格式
        frame = camera.capture()
        camera.stop()
        img = np.array(frame, dtype=np.uint8)
        img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
        return img

if __name__ == "__main__":
    numberOfCameras = int(input("Number of cameras:"))
    configureMultiCamera()
    
    while True:
        startTime = time.time()
        img_list = []
        
        for i in range(1, numberOfCameras+1):
            enableCamera(i)
            img = capture(i)
            img_list.append(img)
        
        # 保留原displayImage逻辑不变
        displayImage(img_list, 1)
        
        totalTime = time.time() - startTime
        print(f"Aquisition time: {totalTime:.2f}s")
        print(f"FPS(all cameras): {1/totalTime:.2f}")
        
        key = cv2.waitKey(7) % 0x100
        if key == 27:
            break
    
    disableMultiCamera()
    cv2.destroyAllWindows()

3. 额外注意事项

  • 确保LePotato的Raspbian系统为最新版本,避免兼容性问题;
  • 检查Arducam多路适配器的接线是否正确,特别是DIO控制引脚的连接;
  • 如果使用Arducam专用SDK,需按照官方说明替换代码中的摄像头捕获逻辑。

内容的提问来源于stack exchange,提问作者Marco Kurepa

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.27 20:17:07