分类 网站源码 下的文章 - 资源洞
首页
意见反馈
关于我们
使用攻略
搜 索
1
【分享】斗转多开〓微信、钉钉等〓改定位100%成功〓支持改国外
177 阅读
2
【模块分享】QQ模块集合
115 阅读
3
【分享】云听音乐白嫖全网音乐 可下载 高音质
112 阅读
4
【原创】QQ等级加速,一键完成全部任务,免费送礼
108 阅读
5
王者荣耀BUG卡国标最新方法
76 阅读
福利活动
游戏推荐
娱乐视频
互联网
头像分享
网站源码
资源杂烩
软件基地
电影分享
技术教程
美图分享
网站公告
登录
/
注册
搜 索
深蓝
累计撰写
10,017
篇文章
累计收到
12
条评论
首页
栏目
福利活动
游戏推荐
娱乐视频
互联网
头像分享
网站源码
资源杂烩
软件基地
电影分享
技术教程
美图分享
网站公告
页面
意见反馈
关于我们
使用攻略
用户登录
登录
注册
找到
19
篇与
网站源码
相关的结果
2023-08-14
python批量去除图片文字水印
#!/usr/bin/env python # -*- coding:utf-8 -*- # 需要安装的库 # pip install paddlepaddle -i https://mirrors.aliyun.com/pypi/simple/ # pip install paddleocr -i https://mirrors.aliyun.com/pypi/simple/ # pip install cv2 -i https://mirrors.aliyun.com/pypi/simple/ # pip install numpy -i https://mirrors.aliyun.com/pypi/simple/ # pip install Pillow -i https://mirrors.aliyun.com/pypi/simple/ import os import cv2 import numpy as np from PIL import Image from paddleocr import PaddleOCR, draw_ocr class DeleteImageWatermark: def __init__(self): pass def distinguish_string(self, img_path, lang='ch'): """ 得到文字识别结果列表 img_path: 图片路径 lang: 默认为识别中文 return: 返回所有被识别到的文字文本框坐标、文字内容和置信度 如:[ [[[1415.0, 977.0], [1482.0, 977.0], [1482.0, 1001.0], [1415.0, 1001.0]], ('小红书', 0.868567168712616)], [[[1441.0, 1001.0], [1493.0, 1001.0], [1493.0, 1024.0], [1441.0, 1024.0]], ('小红书', 0.9620211124420166)] ] """ orc = PaddleOCR(use_angle_cls=True, lang=lang) result = orc.ocr(img_path, cls=True) return result def save_distinguish_result(self, result, img_path, save_path): """ 将识别文字的结果输出图片 """ image = Image.open(img_path).convert('RGB') boxes = [line[0] for line in result] txts = [line[1][0] for line in result] scores = [line[1][1] for line in result] im_show = draw_ocr(image, boxes, txts, scores, font_path='./fonts/simfang.ttf') im_show = Image.fromarray(im_show) im_show.save(save_path) def delete_watermark(self, result_list, kw_list, img_path, delete_path): """ 将符合目标的水印,模糊化处理 """ # 获取所有符合目标的文本框位置 text_axes_list = [] for line in result_list: for kw in kw_list: if kw in line[1][0]: min_width = int(min(line[0][0][0], line[0][3][0])) max_width = int(max(line[0][1][0], line[0][2][0])) min_hight = int(min(line[0][0][1], line[0][1][1])) max_hight = int(max(line[0][2][1], line[0][3][1])) text_axes_list.append([min_width, min_hight, max_width, max_hight]) break # 去除水印 delt = 10 # 文本框范围扩大 img = cv2.imread(img_path, 1) tmp_delete_path = delete_path.split('.')[0] + '_test.' + delete_path.split('.')[1] # 临时图片地址 cv2.imwrite(tmp_delete_path, img) for text_axes in text_axes_list: img = cv2.imread(tmp_delete_path, 1) hight, width = img.shape[0:2] # 截取图片 min_width = text_axes[0] - delt if text_axes[0] - delt >= 0 else 0 min_hight = text_axes[1] - delt if text_axes[1] - delt >= 0 else 0 max_width = text_axes[2] + delt if text_axes[2] + delt <= width else width max_hight = text_axes[3] + delt if text_axes[3] + delt <= hight else hight cropped = img[min_hight:max_hight, min_width:max_width] # 裁剪坐标为[y0:y1, x0:x1] cv2.imwrite(delete_path, cropped) # 保存截取的图片 imgSY = cv2.imread(delete_path, 1) # 图片二值化处理,把[200,200,200]-[250,250,250]以外的颜色变成0 start_rgb = 200 thresh = cv2.inRange(imgSY, np.array([start_rgb, start_rgb, start_rgb]), np.array([250, 250, 250])) # 创建形状和尺寸的结构元素 kernel = np.ones((3, 3), np.uint8) # 设置卷积核3*3全是1;将当前的数组作为图像类型来进⾏各种操作,就要转换到uint8类型 # 扩展待修复区域 hi_mask = cv2.dilate(thresh, kernel, iterations=10) # 膨胀操作,白色区域增大,iterations迭代次数 specular = cv2.inpaint(imgSY, hi_mask, 5, flags=cv2.INPAINT_TELEA) # imgSY:输入8位1通道或3通道图像。 # hi_mask:修复掩码,8位1通道图像。非零像素表示需要修复的区域。 # specular:输出与imgSY具有相同大小和类型的图像。 # 5:算法考虑的每个点的圆形邻域的半径。 # flags:NPAINT_NS基于Navier-Stokes的方法、Alexandru Telea的INPAINT_TELEA方法 cv2.imwrite(delete_path, specular) # 覆盖图片 imgSY = Image.open(delete_path) img = Image.open(tmp_delete_path) img.paste(imgSY, (min_width, min_hight, max_width, max_hight)) img.save(tmp_delete_path) os.remove(delete_path) os.rename(tmp_delete_path, delete_path) def has_kw(self, result_list, kw_list): """ 图片是否包含目标水印,返回匹配到的文字列表 """ result_str_list = [] for line in result_list: for kw in kw_list: if kw in line[1][0]: result_str_list.append(line[1][0]) break return result_str_list def main(kw_list, img_path, result_path): """ kw_list: 需要识别的文字列表 img_path: 输入的图片地址 result_path: 输出去水印的结果图片地址 """ d = DeleteImageWatermark() # 识别文字 result = d.distinguish_string(img_path) for line in result: print(line) # 打印识别结果:识别到的文字文本框坐标、文字内容和置信度 # 显示文字识别结果 d.save_distinguish_result(result, img_path, os.path.dirname(__file__) + '/test_01.jpg') # 是否含有指定水印 result_str_list = d.has_kw(result, kw_list) if len(result_str_list) > 0: # 删除水印 d.delete_watermark(result, kw_list, img_path, result_path) print('共有 %d 处水印,都已删除成功!' % len(result_str_list)) return True else: print('无指定水印!') return False if __name__ == '__main__': # 图片地址 #path = os.path.dirname(__file__) path=os.getcwd() img_path = path + '/去除水印.jpg' result_path = path + "/result.jpg" # 删除指定水印 kw_list = [ '快手', '抖音', '网易云'] main(kw_list, img_path, result_path)
2023年08月14日
6 阅读
0 评论
0 点赞
2023-08-12
LeavePay免授权最新版 三网免挂免签约支付源码
[hide]https://luos.lanzouj.com/iZKGr156pejg[/hide]
2023年08月12日
14 阅读
0 评论
0 点赞
2023-08-11
2023最新小丫软件库 全新开源APP源码 PHP后端
[hide]https://luos.lanzouj.com/ina3H151letc[/hide]
2023年08月11日
19 阅读
0 评论
0 点赞
2023-08-11
诺讯VIP影视解析开心版源码
源码介绍:跳过诺讯付费端服务器验证,免key直接调用诺讯付费端API,测试返回数据无加密。使用教程:直接上传至服务器站点根目录,无需填写uid和key,调用方式为:http(s)://域名/?url=调用示例:http(s)://域名/?url=https://www.iqiyi.com/v_27d5ltb7u58.html[hide]https://luos.lanzouj.com/iu6ep12lvdih[/hide]
2023年08月11日
6 阅读
0 评论
0 点赞
2023-08-11
腾讯视频VIP一次解析api源码
第一步:代码第43行 $VIPCookies = '';// 必填VIP Cookies 使用会员帐号cookies第二步:上传到服务器,使用方法:https://域名/文件名/?url=视频地址返回格式JSON,需要用到M3U8播放器播放!代码如下![hide]<?php /** * 腾讯视频VIP一次解析api源码 */ //使用教程 //参数 url=视频地址 type=输出方式(json/dplayer) error_reporting(0); // allow cross header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Methods: GET'); $url = isset($_GET['url']) ? $_GET['url'] : ''; $type = isset($_GET['type']) ? $_GET['type'] : ''; $api = new Tvideo(); $data = $api->Tvideo_api($url); if ($type == 'dplayer') { $file_path = __DIR__ . '/src/DPlayer.html'; if (file_exists($file_path)) { echo file_get_contents($file_path); } exit; }else{ header('content-type:application/json;charset=utf8'); exit(json_encode($data,480)); } //腾讯视频解析 class Tvideo{ public function Tvideo_api($url){ $content = $this->curl($url); preg_match('#data-vid="(\w+)" data-cid="(\w+)"#iU',$content,$id); $cid = !isset($id[2])? id[2]; if (basename($url,'.html')==$cid) { $vid = !isset($id[1])? id[1]; }else { $vid=basename($url,'.html'); } $curl ='https://vv.video.qq.com/getinfo?encver=2&defn=shd&platform=10801&otype=ojson&sdtfrom=v4138&appVer=7&dtype=3&vid='.$vid.'&newnettype=1'; $VIPCookies = '';// 必填VIP Cookies $JsonInfo = $this->vip_curl($curl,$VIPCookies); $JsonData = json_decode($JsonInfo,true); $vurl = $JsonData["vl"]["vi"][0]['ul']['ui'][3]['url'].$JsonData["vl"]["vi"][0]['ul']['ui'][3]['hls']['pt']; if($JsonData['em']==61){ $result = array( 'code' => 1, 'msg' => '解析失败!' ); }else{ $result = array( 'code' => 0, 'msg' => '解析成功!', 'url' => $vurl, 'm3u8_to'=>$JsonData["vl"]["vi"][0]['ul']['ui'][3]['url'] ); } return $result; } public function curl($url){ $curl = curl_init(); $header = array( "X-FORWARDED-FOR:".long2ip(mt_rand(1884815360, 1884890111)), "CLIENT-IP:".long2ip(mt_rand(1884815360, 1884890111)), "X-Real-IP:".long2ip(mt_rand(1884815360, 1884890111)), "Accept:application/json, text/javascript, */*; q=0.01", "Accept-Language:zh-CN,zh;q=0.9", "Connection: Keep-Alive", "Referer:https://v.qq.com", "User-Agent:Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36 QIHU 360EE", "X-Requested-With:XMLHttpRequest", ); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($curl, CURLOPT_RETURNTRANSFER,true); curl_setopt($curl, CURLOPT_HTTPHEADER, $header); curl_setopt($curl, CURLOPT_FOLLOWLOCATION,1); curl_setopt($curl, CURLOPT_HEADER,0); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($curl, CURLOPT_TIMEOUT, 10); return curl_exec($curl); } public function getC($str, $leftStr, $rightStr) { $left = strpos($str, $leftStr); $right = strpos($str, $rightStr,$left); if($left < 0 or $right < $left) return ''; return substr($str, $left + strlen($leftStr), $right-$left-strlen($leftStr)); } public function vip_curl($url,$cookie='') { $header = array ( 0 => 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', 1 => 'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,zh-HK;q=0.7', 2 => 'Cache-Control: max-age=0', 3 => 'Connection: keep-alive', 4 => 'Sec-Fetch-Dest: document', 5 => 'Sec-Fetch-Mode: navigate', 6 => 'Sec-Fetch-Site: none', 7 => 'Sec-Fetch-User: ?1', 8 => 'Upgrade-Insecure-Requests: 1', 9 => 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36', 10 => 'sec-ch-ua: ^\\^', 11 => 'sec-ch-ua-mobile: ?0', 12 => 'sec-ch-ua-platform: ^\\^', 13 =>'Cookie:'.$cookie ); $timeout = 10; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_ENCODING, "gzip"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); if(substr($url, 0, 8) === 'https://') { curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); } if(!empty($postData)) { curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); } if(!empty($cookie)) { $header[] = $cookie; } if(!empty($header)) { curl_setopt($ch, CURLOPT_HTTPHEADER, $header); } curl_setopt($ch, CURLOPT_TIMEOUT, (int)$timeout); $content = curl_exec($ch); if($error = curl_error($ch)) { error_log($error); } curl_close($ch); return $content; } public function rand_ip(){ $ip_long = array( array('607649792', '608174079'), //36.56.0.0-36.63.255.255 array('975044608', '977272831'), //58.30.0.0-58.63.255.255 array('999751680', '999784447'), //59.151.0.0-59.151.127.255 array('1019346944', '1019478015'), //60.194.0.0-60.195.255.255 array('1038614528', '1039007743'), //61.232.0.0-61.237.255.255 array('1783627776', '1784676351'), //106.80.0.0-106.95.255.255 array('1947009024', '1947074559'), //116.13.0.0-116.13.255.255 array('1987051520', '1988034559'), //118.112.0.0-118.126.255.255 array('2035023872', '2035154943'), //121.76.0.0-121.77.255.255 array('2078801920', '2079064063'), //123.232.0.0-123.235.255.255 array('-1950089216', '-1948778497'), //139.196.0.0-139.215.255.255 array('-1425539072', '-1425014785'), //171.8.0.0-171.15.255.255 array('-1236271104', '-1235419137'), //182.80.0.0-182.92.255.255 array('-770113536', '-768606209'), //210.25.0.0-210.47.255.255 array('-569376768', '-564133889'), //222.16.0.0-222.95.255.255 ); $rand_key = mt_rand(0, 14); $huoduan_ip= long2ip(mt_rand($ip_long[$rand_key][0], $ip_long[$rand_key][1])); return $huoduan_ip; } } [/hide]
2023年08月11日
7 阅读
0 评论
0 点赞
1
2
...
4