首页
畅所欲言
友情链接
壁纸大全
数据统计
推荐
工具箱
在线白板
Search
1
职教云小助手重构更新,职教云助手最新版下载地址【已和谐】
13,576 阅读
2
职教云-智慧职教,网课观看分析(秒刷网课)
11,107 阅读
3
gradle-5.4.1-all.zip下载
9,067 阅读
4
职教云-智慧职教,签到补签分析(逆天改命系列)
7,949 阅读
5
一个优秀的程序员从写文档开始:免费领14个月语雀云笔记会员
6,911 阅读
学习笔记
Web
Python
转载文章
算法刷题
JS逆向
综合笔记
安卓
物联网
Java
C
资源收集
软件收藏
网络资源
影视专辑
TED英语角
随便写写
随手拍
登录
/
注册
Search
Lan
累计撰写
626
篇文章
累计收到
625
条评论
首页
栏目
学习笔记
Web
Python
转载文章
算法刷题
JS逆向
综合笔记
安卓
物联网
Java
C
资源收集
软件收藏
网络资源
影视专辑
TED英语角
随便写写
随手拍
页面
畅所欲言
友情链接
壁纸大全
数据统计
推荐
工具箱
在线白板
搜索到
626
篇与
的结果
2024-05-14
原生Js Canvas去除视频绿幕背景
Js去除视频背景注: 这里的去除视频背景并不是对视频文件进行操作去除背景如果需要对视频扣除背景并导出可以使用ffmpeg等库,这里仅作播放用所以采用这种方法由于uniapp中的canvas经过封装,且 uniapp 的 drawImage 无法绘制视频帧画面,因此uniapp中不适用实现过程是将视频使用canvas逐帧截下来对截取的图片进行处理,然后在canvas中显示处理好的图片最后通过定时器高速处理替换,形成视频播放的效果,效果如下图⬇原文链接:https://blog.csdn.net/Raccon_/article/details/132732976<template> <div class="videoBgRemove"> <video id="video" src="/images/example.mp4" loop autoplay muted ref="video" style="width: 240px;height: 135px;"></video> <canvas id="output-canvas" width="240" height="135" willReadFrequently="true" ref="canvas"></canvas> </div> </template> <script setup> import {ref, onMounted} from 'vue'; const video = ref(null); const canvas = ref(null); const ctx = ref(null); const canvas_tmp = ref(null); const ctx_tmp = ref(null); const init = () => { ctx.value = canvas.value.getContext('2d'); // 创建的canvas宽高最好与显示图片的canvas、video宽高一致 canvas_tmp.value = document.createElement('canvas'); canvas_tmp.value.setAttribute('width', 240); canvas_tmp.value.setAttribute('height', 135); ctx_tmp.value = canvas_tmp.value.getContext('2d'); video.value.addEventListener('play', computeFrame); } const numToPoint = (num, width) => { let col = num % width; let row = Math.floor(num / width); row = col === 0 ? row : row + 1; col = col === 0 ? width : col; return [row, col]; } const pointToNum = (point, width) => { let [row, col] = point; return (row - 1) * width + col } const getAroundPoint = (point, width, height, area) => { let [row, col] = point; let allAround = []; if (row > height || col > width || row < 0 || col < 0) return allAround; for (let i = 0; i < area; i++) { let pRow = row - 1 + i; for (let j = 0; j < area; j++) { let pCol = col - 1 + j; if (i === area % 2 && j === area % 2) continue; allAround.push([pRow, pCol]); } } return allAround.filter(([iRow, iCol]) => { return (iRow > 0 && iCol > 0) && (iRow <= height && iCol <= width); }) } const computeFrame = () => { if (video.value) { if (video.value.paused || video.value.ended) return; } // 如果视频比例和canvas比例不正确可能会出现显示形变, 调整除的值进行比例调整 ctx_tmp.value.drawImage(video.value, 0, 0, video.value.clientWidth / 1, video.value.clientHeight / 1); // 获取到绘制的canvas的所有像素rgba值组成的数组 let frame = ctx_tmp.value.getImageData(0, 0, video.value.clientWidth, video.value.clientHeight); //----- emergence ---------- const height = frame.height; const width = frame.width; const pointLens = frame.data.length / 4; for (let i = 0; i < pointLens; i++) { let r = frame.data[i * 4]; let g = frame.data[i * 4 + 1]; let b = frame.data[i * 4 + 2]; if (r < 100 && g > 120 && b < 200) { frame.data[i * 4 + 3] = 0; } } const tempData = [...frame.data] for (let i = 0; i < pointLens; i++) { if (frame.data[i * 4 + 3] === 0) continue const currentPoint = numToPoint(i + 1, width); const arroundPoint = getAroundPoint(currentPoint, width, height, 3); let opNum = 0; let rSum = 0; let gSum = 0; let bSum = 0; arroundPoint.forEach((position) => { const index = pointToNum(position, width); rSum = rSum + tempData[(index - 1) * 4]; gSum = gSum + tempData[(index - 1) * 4 + 1]; bSum = bSum + tempData[(index - 1) * 4 + 2]; if (tempData[(index - 1) * 4 + 3] !== 255) opNum++; }) let alpha = (255 / arroundPoint.length) * (arroundPoint.length - opNum); if (alpha !== 255) { // debugger frame.data[i * 4] = parseInt(rSum / arroundPoint.length); frame.data[i * 4 + 1] = parseInt(gSum / arroundPoint.length); frame.data[i * 4 + 2] = parseInt(bSum / arroundPoint.length); frame.data[i * 4 + 3] = parseInt(alpha); } } //------------------------ ctx.value.putImageData(frame, 0, 0); setTimeout(computeFrame, 0); } onMounted(() => { init(); }) </script>
2024年05月14日
192 阅读
0 评论
0 点赞
2024-03-27
推荐一个随机头像组件
DiceBear 骰子熊The avatar library you've always been looking for.您一直在寻找的头像库。Create avatars for your profiles, designs, websites or apps. Piece by piece or based on a seed.为您的个人资料、设计、网站或应用程序创建头像。一点一点或基于种子。More than 25 avatar styles!超过25种头像风格!Among our avatar styles you're sure to find one that perfectly fits to you and your project.在我们的头像样式中,您一定会找到一种最适合您和您的项目的样式。Fully customizable! 完全可定制!Each avatar style comes with several options that allow you to create individual avatars.每个头像样式都带有多个选项,可让您创建单独的头像。Free and fast HTTP API!免费且快速的 HTTP API!Start directly with our free HTTP API - no registration required.直接使用我们的免费 HTTP API 开始 - 无需注册。链接:https://www.dicebear.com/
2024年03月27日
207 阅读
1 评论
0 点赞
2024-01-18
推荐一个白板开源程序:Excalidraw
Excalidraw is a whiteboard tool that lets you easily sketch diagrams that have a hand-drawn feel to them.Excalidraw是一个白板工具,可以让你轻松地绘制出手绘的图表。An open source virtual hand-drawn style whiteboard.Collaborative and end-to-end encrypted.一个开源的虚拟手绘风格白板.协作和端到端加密。FeaturesThe Excalidraw editor (npm package) supports:Free & open-source.Infinite, canvas-based whiteboard.Hand-drawn like style.Dark mode.Customizable.Image support.Shape libraries support.Localization (i18n) support.Export to PNG, SVG & clipboard.Open format - export drawings as an .excalidraw json file.Wide range of tools - rectangle, circle, diamond, arrow, line, free-draw, eraser...Arrow-binding & labeled arrows.Undo / Redo.Zoom and panning support.Github地址:https://github.com/excalidraw/excalidraw搭建一个:https://draw.lanol.cn
2024年01月18日
270 阅读
1 评论
0 点赞
2024-01-08
根据日期对mysql数据分组之后查询每个日期中的不同状态的数量
要根据日期对MySQL中的数据进行分组,并查询每个日期中不同状态的数量,可以使用COUNT和CASE语句结合GROUP BY语句。以下是一个示例查询,它将根据create_at字段的日期进行分组,并计算每个日期中不同status的数量:SELECT DATE(create_at) AS date, COUNT(case WHEN `status`=0 then `status` END) as status0Count, COUNT(case WHEN `status`=1 then `status` END) as status1Count, COUNT(case WHEN `status`=2 then `status` END) as status2Count FROM your_table GROUP BY date;在这个查询中,DATE(create_at)用于将create_at字段转换为日期格式(忽略时间部分),然后按这个日期进行分组。COUNT(case WHEN status=0 then status END)等语句用于计算每个日期中status为0、1、2的记录数量。请将your_table替换为你的实际表名,并根据你的实际情况调整status的值和数量
2024年01月08日
163 阅读
2 评论
0 点赞
2024-01-01
Chrome 下载 http 进度 卡住
好像最近升级之后,下载http的资源,都会卡进度然后发现居然还能开启多线程下载{dotted startColor="#ff6c6c" endColor="#1989fa"/}更新一下,是因为我使用了浏览器拓展:下载,然后下载http的需要去浏览器自带的下载页面去允许保存,不然无法保存可以按Ctrl+J
2024年01月01日
185 阅读
0 评论
0 点赞
2023-12-17
推荐一个免费住宅IP代理
试了下,用来注册一些东西什么的确实不会被封,还可以。【全球代理IP免费用】!免费用!免费用!全球200+国家,9000w+动态IP,没任何费用!动态住宅IP/静态住宅IP/机房IP等,永久免费!点击注册,永久免费海外IP.更新:IP质量不行了,并且邀请也不给通过(PS:没有自己刷,这篇文章在谷歌搜索排名第一,根本不需要刷)
2023年12月17日
1,644 阅读
2 评论
2 点赞
2023-12-07
获取Github Copilot的Token
写了一个小工具,可以获取Copilot的Token然后用做其他用途工具链接: Get Copilot Token
2023年12月07日
670 阅读
4 评论
0 点赞
1
2
3
...
90