当前位置: 首页 > article >正文

Linux平台UOS系统摄像头播放

关于播放功能做了很久得研究,网上关于Linux平台摄像头播放资料比较少,目前研究出3种实现摄像头播放的方式。

注:三种方式均在jdk版本21基础上实现。

一  WebCam实现本地摄像头预览

1.引入webcam

在pom.xml中加入,即可

 <dependency>
            <groupId>com.github.sarxos</groupId>
            <artifactId>webcam-capture</artifactId>
            <version>0.3.12</version>
  </dependency>

源项目见:GitHub - sarxos/webcam-capture

2.代码

 public void initWebcam() {
        try {
            if (!Webcam.getWebcams().isEmpty()){
                webcam = Webcam.getWebcams().get(0);
                webcam.open();
                startPlayLiving();
            }
        }catch (Exception e){
            System.out.println("e.getMessage() = " + e.getMessage());
            stopPlayingVideo();
        }
    }

 private void startPlayLiving(){
        cachedThread.execute(()->{
            while (true){
                try {
                    if (webcam==null){
                        return;
                    }
                    BufferedImage bufferedImage=webcam.getImage();
                    if (bufferedImage == null) {
                        r

http://www.kler.cn/news/310721.html

相关文章:

  • 爬虫--翻页tips
  • .Net Gacutil工具(全局程序集缓存工具)使用教程
  • qt-creator-10.0.2之后版本的jom.exe构建和编译速度慢下来了
  • 【Python日志功能】二.高级配置与日志处理器
  • 怎么浏览URL的PDF文件呢
  • 性能测试笔记
  • 【Linux】网络层协议——IP
  • 跨界融合,GIS如何赋能游戏商业——以《黑神话:悟空》为例
  • flutter hive的使用
  • 万兆时代 TCP/IP如何赋能以太网飞跃
  • CentOS 中使用 OpenSSL 查看 SSL 证书详细信息
  • 利用模糊综合评价法进行数值评分计算——算法过程
  • JS 性能优化
  • Linux Kernel Makefiles 编译标志详解
  • C++在Linux实现多线程和多进程的TCP服务器和客户端通信
  • 【公告】博客正在迁移至 git pages
  • RaisePropertyChanged(() => DateName)详解记录一下
  • 前端开发之迭代器模式
  • linux 解压缩
  • 用Python获取PDF页面的大小、方向和旋转角度
  • 75年来最强台风中,开门见“光明”!百年乳企守护城市“奶瓶子”,传递温度
  • 从HarmonyOS升级到HarmonyOS NEXT-环信SDK数据迁移
  • 2024年最新版Vue3学习笔记
  • Pandas语句
  • 【笔记】进制转换
  • Redis技术解析(基础篇)
  • spring boot 定时器配置
  • Qt中pro项目文件配置介绍
  • 智慧园区:解析集成运维的未来之路
  • 在 Windows 上恢复已删除的 PDF 文件的最佳方法