当前位置:网站首页>树莓派CSI/USB摄像头使用mjpg实现网页摄像头监控
树莓派CSI/USB摄像头使用mjpg实现网页摄像头监控
2022-07-06 09:27:00 【帅帅气气的黑猫警长】
本文是整理内容方便自己使用,原文:
1、https://blog.csdn.net/qq_36798753/article/details/78082006
2、https://blog.csdn.net/wto882dim/article/details/82195001
第一步:下载源码
wget https://github.com/jacksonliam/mjpg-streamer/archive/master.zip第二步:下载相关依赖包
sudo apt-get install libjpeg8-dev
sudo apt-get install cmake第三步:解压+安装
unzip master.zip
cd mjpg-streamer-master/mjpg-streamer-experimental
make clean all第四步:制作启动脚本
1、进入mjpg主目录下
2、创建启动脚本
vi jk.sh3、编辑jk.sh
若是使用CSI摄像头
cd mjpg-streamer-master/mjpg-streamer-experimental
./mjpg_streamer -i "./input_raspicam.so" -o "./output_http.so -w ./www"若是使用USB摄像头
cd mjpg-streamer-master/mjpg-streamer-experimental
./mjpg_streamer -i "./input_uvc.so" -o "./output_http.so -w ./www"4、给jk.sh加权限
chmod 744 jk.sh第五步:执行脚本
./jk.sh若是想后台运行可以使用以下命令
nohup ./jk.sh &启动之后就可以在同一局域网浏览器上输入默认地址查看
http://树莓派IP:8080这里可以自己写一个html网页,查看视频,代码如下
<!DOCTYPE html>
<html>
<head>
<title>实时视频</title>
<style>
#webcam{
width: 60%;
height: 60%;
display: block;
margin: 0% ;
text-align: center;
position: relative;
}
#webcam img{
width: 100%;
height: auto;
display: block;
margin: 0 auto;
}
</style>
</head>
<body>
<div id="webcam">
<div>
</div>
</div>
<script type="text/javascript">
var imageNr = 0; // 图片的索引号
var finished = new Array(); // 下载图片的队列
var paused = false; //
function createImageLayer() {
var img = new Image();
img.style.position = "absolute";
img.style.zIndex = -1;
img.onload = imageOnload;
img.onclick = imageOnclick;
//填你对应的ip和端口
img.src = "http://192.168.0.117:8080/?action=snapshot&n=" + (++imageNr);
var webcam = document.getElementById("webcam");
webcam.insertBefore(img, webcam.firstChild);
}
function imageOnload() {
this.style.zIndex = imageNr;
while (1 < finished.length) {
var del = finished.shift(); // 删除旧照片
del.parentNode.removeChild(del);
}
finished.push(this);
if (!paused) createImageLayer();
}
function imageOnclick() {
paused = !paused;
if (!paused) createImageLayer();
}
createImageLayer()
</script>
</body>
</html>边栏推荐
- [exercise-7] crossover answers
- Record of force deduction and question brushing
- Accounting regulations and professional ethics [5]
- Accounting regulations and professional ethics [3]
- 【练习-10】 Unread Messages(未读消息)
- 渗透测试 2 --- XSS、CSRF、文件上传、文件包含、反序列化漏洞
- China's PCB connector market trend report, technological innovation and market forecast
- Record of brushing questions with force deduction -- complete knapsack problem (I)
- Cost accounting [13]
- C 基本语法
猜你喜欢

信息安全-安全编排自动化与响应 (SOAR) 技术解析

渗透测试 ( 8 ) --- Burp Suite Pro 官方文档

渗透测试 ( 5 ) --- 扫描之王 nmap、渗透测试工具实战技巧合集

Information security - threat detection - detailed design of NAT log access threat detection platform
frida hook so层、protobuf 数据解析

Essai de pénétration (1) - - outils nécessaires, navigation

用C语言写网页游戏

【练习-5】(Uva 839)Not so Mobile(天平)

C语言必背代码大全

X-Forwarded-For详解、如何获取到客户端IP
随机推荐
PySide6 信号、槽
【练习-5】(Uva 839)Not so Mobile(天平)
MySQL授予用户指定内容的操作权限
Research Report on shell heater industry - market status analysis and development prospect forecast
Opencv learning log 30 -- histogram equalization
Opencv learning log 18 Canny operator
VS2019初步使用
【练习-6】(PTA)分而治之
[analysis of teacher Gao's software needs] collection of exercises and answers for level 20 cloud class
程序员的你,有哪些炫技的代码写法?
Printing quality inspection and verification system Industry Research Report - market status analysis and development prospect forecast
CEP used by Flink
HDU-6025-Coprime Sequence(女生赛)
【练习-11】4 Values whose Sum is 0(和为0的4个值)
[exercise-3] (UVA 442) matrix chain multiplication
Path problem before dynamic planning
STM32 learning record: LED light flashes (register version)
Research Report of cylindrical grinder industry - market status analysis and development prospect forecast
B - 代码派对(女生赛)
SSM框架常用配置文件