电子烂人 发表于 2025-1-9 10:19

【Raspberry Pi 5测评】1.系统与OPENCV环境

<div class='showpostmsg'> 本帖最后由 电子烂人 于 2025-1-12 11:29 编辑

<p>收到了得捷的树莓派,开箱部分和组装就先跳过;</p>

<p><span style="font-size:18px;"><strong>1.系统镜像烧录</strong></span></p>

<p>不同于去年一月份玩的,这次树莓派5增加了UBT 24.10的支持,是一个长期支持版本,更好用一些:</p>

<p> &nbsp;</p>

<p>要注意,烧录ubt的桌面系统,插卡之后有一段引导配置,需要插屏幕操作;没屏幕的话也可以直接烧录SERVER版本。&nbsp; &nbsp;</p>

<p>UBT24.10的吉祥物是<strong>Oracular Oriole&nbsp;</strong>神谕黄鹂、也叫&ldquo;高深莫测的黄鹂&rdquo;(oracular:神谕般的,天书般的,高深莫测的),官方的图像是一只简笔画的鸟,周围围绕一圈天体学与神学符号,对比之前吉祥物的更加简洁。</p>

<p>官方介绍:<a href="https://cn.ubuntu.com/blog/canonical-releases-ubuntu-24-10-oracular-oriole_cn">Canonical 发布 Ubuntu 24.10 Oracular Oriole | Ubuntu</a></p>

<p style="text-align: center;">&nbsp;</p>

<p style="text-align: center;"><i>鸟儿能有什么坏心思鸟</i></p>

<p>&nbsp;</p>

<p>系统正常进入如图:</p>

<p></p>

<p><span style="font-size:18px;"><strong>2.openCV部分</strong></span></p>

<p>实在不喜欢在PYTHON里装OPENCV,降低性能</p>

<p>这部分直接参考微雪的历程:<a href="https://www.waveshare.net/study/article-900-1.html">树莓派OpenCV系列教程1:开发环境搭建 - 树莓派OpenCV教程 微雪课堂 (waveshare.net)</a></p>

<p>因为是UBT系统,系统自带PYTHON3不用安装</p>

<p>PIP安装必要的库:</p>

<pre>
<code class="language-bash">sudo pip3 install numpy</code></pre>

<div>因为是要用CMAKE编译,所以安装依赖:</div>

<div>
<pre>
<code class="language-bash">sudo apt-get install build-essential git cmake pkg-config -y
sudo apt-get install libjpeg8-dev -y
sudo apt-get install libtiff5-dev -y
sudo apt-get install libjasper-dev -y
sudo apt-get install libpng12-dev -y

sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev -y

sudo apt-get install libgtk2.0-dev -y
sudo apt-get install libatlas-base-dev gfortran -y</code></pre>

<p>之后从GIT下载OPENCV源码到本地编译,克隆这一步非常漫长,纯纯抽奖:</p>

<pre>
<code class="language-bash"> git clone -b 4.1.0 --recursive https://github.com/opencv/opencv.git
git clone -b 4.1.0 --recursive https://github.com/opencv/opencv_contrib.git</code></pre>

<p>建议是在电脑上挂梯子下好,再用U盘拷贝到PI5里面</p>

<p>需要先用CMAK生成MAIKFILE,先进入BUILD目录</p>

<pre>
<code class="language-bash">cd /home/pi/Downloads/opencv-4.1.0
mkdir build
cd build</code></pre>

<p>微雪的教材讲的不够详细,建议自己了解一下CMAKE,再去具体的编译</p>

<p>首推菜鸟教程:<a href="https://www.runoob.com/cmake/cmake-install-setup.html">CMake 安装与配置 | 菜鸟教程 (runoob.com)</a></p>

<pre>
<code class="language-bash">cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_C_EXAMPLES=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D OPENCV_EXTRA_MODULES_PATH=/home/pi/Downloads/opencv-4.1.0/opencv_contrib-3.4.0/modules \
-D BUILD_EXAMPLES=ON \
-D WITH_LIBV4L=ON \
-D PYTHON3_EXECUTABLE=/usr/bin/python3.7 \
-D PYTHON_INCLUDE_DIR=/usr/include/python3.7 \
-D PYTHON_LIBRARY=/usr/lib/arm-linux-gnueabihf/libpython3.7m.so \
-D PYTHON3_NUMPY_INCLUDE_DIRS=/usr/lib/python3/dist-packages/numpy/core/include \</code></pre>

<p>生成好makefile,然后就是编译opencv了</p>
</div>

<pre>
<code class="language-bash">make</code></pre>

<p>更漫长的等待。。。起码要两三个小时,我这边是直接让PI5挂机,去睡了一觉回来</p>

<p>&nbsp;</p>

<p>&nbsp;</p>
</div><script>                                        var loginstr = '<div class="locked">查看本帖全部内容,请<a href="javascript:;"   style="color:#e60000" class="loginf">登录</a>或者<a href="https://bbs.eeworld.com.cn/member.php?mod=register_eeworld.php&action=wechat" style="color:#e60000" target="_blank">注册</a></div>';
                                       
                                        if(parseInt(discuz_uid)==0){
                                                                                                (function($){
                                                        var postHeight = getTextHeight(400);
                                                        $(".showpostmsg").html($(".showpostmsg").html());
                                                        $(".showpostmsg").after(loginstr);
                                                        $(".showpostmsg").css({height:postHeight,overflow:"hidden"});
                                                })(jQuery);
                                        }                </script><script type="text/javascript">(function(d,c){var a=d.createElement("script"),m=d.getElementsByTagName("script"),eewurl="//counter.eeworld.com.cn/pv/count/";a.src=eewurl+c;m.parentNode.insertBefore(a,m)})(document,523)</script>

极限零 发表于 2025-1-14 12:19

<p>居然要用3个小时编译。。是主频不够还是内存不够</p>
页: [1]
查看完整版本: 【Raspberry Pi 5测评】1.系统与OPENCV环境