基于树莓派的流星雨监测系统(RMS)的搭建

本系列第二篇文章:基于树莓派的流星雨监测系统(RMS)的进一步改造(1)_delacroix_xu的专栏-优快云博客

本系列第三篇文章:基于树莓派的流星雨监测系统(RMS)的进一步改造(2)_delacroix_xu的专栏-优快云博客

背景:

近期开始使用一个开源项目,在树莓派4B上玩耍。监测流星雨并存储下来。

GitHub - CroatianMeteorNetwork/RMS: RPi Meteor Station

但官方文档略显复杂,此文章比较适用于试用USB摄像头的用户。如果您使用IP cemera rtsp方式接入,则需要参照官方文档进行。

设备选型

按照官方建议,选择索尼IMX291作为基础的摄像头了,某宝搜索,可以看到很多。选择一个USB3.0接口的。不贵,大概200多RMB

接下来要选择镜头,某宝购买摄像头会自带一个广角镜头,一般是光圈不大的。建议再购买大光圈的镜头。比如F1.2或F1.0的黑光镜头。M12接口即可。

接下来要选择树莓派,官方推荐树莓派4b。原因是三个进程合起来要试用2GB左右的内存,树莓派3b已经无法满足需求。至少要树莓派4b。

第一步,树莓派固定在墙上。用3M双面胶

摄像头用透明胶固定在玻璃上

 最后关键一步,需要用几张纸给改起来,免得有玻璃反光。都是经验所得。楼下汽车路过,会有强光,之前有透明胶附着在摄像头周边,透明胶反光,会被误认为是火流星。

RMS安装过程

官方文档略显复杂,这里简化一下,对于需要使用IP camera  rtsp方式推流的,可以使用 insall_opencv4.sh进行安装。 对于我,则可以简化,不需要编译opencv。

仅仅需要安装所需的 python库,就够了

第一步,创建venv

参考: 关于Python3中venv虚拟环境 - syncd - 博客园

第二步,激活venv

source /home/pi/your_venv/bin/activate

第三部,安装各种依赖库

python -m pip install xxxxxxx  

由于GFW的原因,访问python官方pypi比较慢,这里推荐aliyun的国内镜像。

参考: python pip 切换阿里云镜像 - 静静别跑 - 博客园

参照官方文档,安装各种库

numpy scipy gitpython cython matplotlib 等

安装好依赖库后,再安装 setup.py

python setup.py install

这样RMS作为一个库,被安装到venv下

运行

python -m RMS.StartCapture

写个脚本, 开机自动启动

#!/bin/sh

set -x

. /home/pi/py37env/bin/activate

cnt=`ps aux| grep python | grep StartCapture | wc -l`
if [ $cnt -eq 0 ];then
  rm -f 1.txt
  nohup python -m RMS.StartCapture 1>1.txt 2>&1 &
fi

加入crontab 自动运行

*/10 * * * * cd /home/pi/Desktop/RMS/RMS_new && sh start_by_cron.sh > start.log 2>&1

 修改参数适配大城市光污染

配置文件在RMS根目录下,文件名叫 .config

vim编辑 .config

修改的diff如下:


 ; Enable/disable saving a live.jpg file in the data directory with the latest image
-live_jpg: false
+live_jpg: true
 
 ; Enable/disable showing a slideshow of last night's meteor detections on the screen during the day
 slideshow_enable: false
@@ -114,7 +117,7 @@ win_pc_weave: -Wall
 [Upload]
 
 ; Flag for enabling/disabling upload to server
-upload_enabled: true 
+upload_enabled: false
 ; Delay upload for the given number of minutes
 upload_delay: 0
 ; Server address
@@ -190,7 +193,7 @@ distance_threshold: 70
 ; Maximum allowed gap between points
 gap_threshold: 150 
 ; Minimum range of frames that a line should cover (eliminates flash detections)
-line_minimum_frame_range: 6 
+line_minimum_frame_range: 2 
 ; Constant that determines the influence of average point distance on the line quality
 line_distance_const: 4 
 ; Ratio of how many points must be close to the line before considering searching for another line
@@ -202,7 +205,7 @@ max_lines: 5
 [MeteorDetection]
 
 ; Minimum number of stars required in order to run the detection
-ff_min_stars = 20 
+ff_min_stars = 1 
 
 ; Binning (only supported for videos, images, and vid files, but no FF files!)
 ; -------
@@ -252,7 +255,7 @@ gap_threshold_det: 50
 ; Minimum number of pixels in a strip
 min_pixels_det: 10 
 ; Minimum number of frames per one detection
-line_minimum_frame_range_det: 4 
+line_minimum_frame_range_det: 2 
 ; Constant that determines the influence of average point distance on the line quality
 line_distance_const_det: 4 
 ; Maximum time in seconds for which line finding algorithm can run
@@ -279,7 +282,7 @@ ang_vel_max: 51.0 ; deg/s
 ; Filtering by intensity
 ; By default the peak of the meteor should be at least 16x brighter than the background. This is the 
 ; multiplier that scales this number (1.0 = 16x).
-min_patch_intensity_multiplier: 2.5
+min_patch_intensity_multiplier: 0.25

说明:

line_minimum_frame_range是一个过滤规则,流星轨迹至少要持续多少frame,这里从原来的6帧,改为2帧

ff_min_start是一个过滤规则,不能达到识别到20颗行,就不会执行流星检测逻辑。这里改为1,只要画面里识别到一颗星,就会进行流星监测。

line_minimum_frame_range_det:这个参数,也是一个过滤器,由4改为2,至少4帧改为至少2帧

min_path_intensity_multiplier:这个参数,也是一个过滤器,要求流星要比背景亮多少倍才算流星,否则就不算流星。这里从原来的2.5修改为0.25。原因是大城市光污染大,背景比较亮

监测时间的修改

 监测时间改为晚上11点以后,等屋子的等确定不亮了再开始。否则会引来很多飞虫,飞虫的轨迹,会被误判为火流星。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值