现在说起Pipeline都有点迷糊了,很多都是这个概念。GStreamer里面有,相机里面有,然后还有别的地方也有。

pipeline本身其实没什么特殊的,最经典的出处应该还是CPU的调度算法。简单理解就是一段处理。
define data
stage1(data)
stage2(data)
stage3(data)
晚上查了一下,确实这几个地方都叫pipeline,然后树莓派还有个自己的Post-processing,也就是后处理。今天简单说说camera的和Post-processing的。
1 Camera的pipeline

这张图就非常非常直观了,来自A Software Platform for Manipulating the Camera Imaging Pipeline,
想多参考一点的可以看看下面这几篇:
https://www.cs.unc.edu/~ronisen/teaching/spring_2023/web_materials/lecture4_camera.pdf
https://web.stanford.edu/class/cs231m/lectures/lecture-11-camera-isp.pdf
https://github.com/AbdoKamel/simple-camera-pipeline
处理这个pipeline可以看libcamera的官方文档:Pipeline Handler Writers Guide — libcamera
2 树莓派libcamera的pipeline
基本上就是参照官方文档:https://www.raspberrypi.com/documentation/computers/camera_software.html#post-processing-with-rpicam-apps,事实上就是图像的后处理,可以有多个stage。
比如这个就有两个:
{
"sobel_cv":
{
"ksize": 5
},
"negate": {}
}
一个是sobel_cv,一个是negate。直接在运行libcamera的时候将json作为参数传入:
rpicam-hello --post-process-file negate.json
sobel_cv的效果就是如下:

大概看了一下,树莓派的libcamera下面有三类的Post-processing。
2.1 内建
大概就是negate,sobel_cv,hdr,motion_detect。
2.2 OpenCV
face_detect_cv annotate_cv这几个。其中face_detect_cv配置是这样的:
{
"face_detect_cv" : {
"cascade_name" : "/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt.xml",
"scaling_factor" : 1.1,
"min_neighbors" : 2,
"min_size" : 32,
"max_size" : 256,
"refresh_rate" : 1,
"draw_features" : 1
}
}
效果如下:

有点好奇如果要程序中处理,应该怎么弄呢?
2.3 TensorFlow Lite
这部分就是深度学习的框架了。。。
这里有很多,给一个物体判断的例子:
{
"object_detect_tf" : {
"number_of_threads" : 2,
"refresh_rate" : 10,
"confidence_threshold" : 0.5,
"overlap_threshold" : 0.5,
"model_file" : "/home/<username>/models/coco_ssd_mobilenet_v1_1.0_quant_2018_06_29/detect.tflite",
"labels_file" : "/home/<username>/models/coco_ssd_mobilenet_v1_1.0_quant_2018_06_29/labelmap.txt",
"verbose" : 1
},
"object_detect_draw_cv" : {
"line_thickness" : 2
}
}
也是运行时作为参数传入:
rpicam-hello --post-process-file object_detect_tf.json --lores-width 400 --lores-height 300
看来是要把训练好的tflite文件放上来才行。

最后也可以自建pipeline:https://www.raspberrypi.com/documentation/computers/camera_software.html#write-your-own-post-processing-stages

&spm=1001.2101.3001.5002&articleId=142687452&d=1&t=3&u=1fba6ab008054c11a4ddc72e89e812fe)
1669

被折叠的 条评论
为什么被折叠?



