https://learn.sparkfun.com/tutorials/flir-lepton-hookup-guide
裡面提到很多前置作業, 像是開啟I2C, SPI...
接下來就是抓source code了!
======================================
1. Code for getting started with the FLIR Lepton breakout board
https://github.com/groupgets/LeptonModule
這邊的話, 有用過 raspberrypi_video 與 v4l2lepton 做過測試
A. raspberrypi_video
https://github.com/groupgets/LeptonModule/tree/master/software/raspberrypi_video
sudo raspi-config # enable the SPI and I2C
sudo apt-get install qt4-dev-tools
qmake && make # cd to the LeptonModule/sofware/raspberrypi_video folder
./raspberrypi_video
然後就會看到熱影像畫面了
如果這時候只看到一個紅色框框, 據說是相機模組(?)沒有裝好
把黑色的模組拔下來再重插就好
B. v4l2lepton
https://github.com/groupgets/LeptonModule/tree/master/software/v4l2lepton
這邊有參考台灣樹莓派的流程https://github.com/raspberrypi-tw/meetup19
* Build v4l2loopback virtual device node.
# Install Kernel Source and Header
sudo apt-get update
sudo apt-get install bc libncurses5-dev flex bison
sudo wget https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source -O /usr/bin/rpi-source && sudo chmod +x /usr/bin/rpi-source && /usr/bin/rpi-source -q --tag-update
rpi-source
# Install required module
pip3 install imutils
pip3 install opencv-python==3.4.6.27
* Install V4L2 Kernel Module
$ cd ~
$ git clone https://github.com/umlaeute/v4l2loopback
$ cd ~/v4l2loopback
$ sudo make
$ sudo make install
$ sudo depmod -a
$ sudo modprobe v4l2loopback
* Enable FLIR Camera V4L2
cd ~
git clone https://github.com/groupgets/LeptonModule
cd ~/LeptonModule/software/v4l2lepton
sed -i -e 's/video1/video0/g' v4l2lepton.cpp
make
sudo ./v4l2lepton -v /dev/video0 & -d /dev/spidev0.0 # 這邊的編號會根據每個人的環境發生變化
然後終端機會看到下面的訊息: (要看到第二行的done reading才會有畫面)
Waiting for sink
done reading, resets:
接下來去執行台灣樹莓派的範例 (flir_preview.py)就可以看到熱像儀畫面了
======================================
2. pylepton: Quick and dirty pure python library for interfacing with FLIR lepton
https://github.com/groupgets/pylepton
這邊有流程: https://lepton.flir.com/forums/topic/pylepton-overlay-guide-2-0-for-raspbian-pixel/
sudo apt-get install python-opencv python-numpy
git clone https://github.com/kekiefer/pylepton.git
cd pylepton
sudo python setup.py install
然後執行 pylepton_overlay 就可以看到畫面了
不過這個程式是融合 pi camera 與 熱像儀的畫面, 所以需要設定透明度
官網範例: pylepton_overlay -a 255 就是100% lepton overlay
======================================
後記(?)
感覺要用python去開發的話, 用v4l2lepton 似乎比較方便
只是這個東西似乎沒辦法取代額溫槍來量體溫, 誤差似乎比較大
而且還沒看到校正的方式 QQ
沒有留言:
張貼留言