随笔分类 - Python
摘要:使用langdetect 或者langid 安装 pip install langid or pip install langdetect 适用于linux系统 测试 #! /usr/bin/env python # -*- coding: utf-8 -*-# import langid from
阅读全文
摘要:#! /usr/bin/env python # -*- coding: utf-8 -*-# # # Name: demo # Author: yunhgu # Date: 2021/8/25 16:02 # Description: # import pytesseract from PIL i
阅读全文
摘要:博客网站 https://blog.csdn.net/as604049322 http://zhangwenli.com/ 音乐 http://www.zgei.com/
阅读全文
摘要:#! /usr/bin/env python # -*- coding: utf-8 -*-# # # Name: 视频人脸追踪 # Author: yunhgu # Date: 2021/9/13 15:13 # Description: # from pathlib import Path im
阅读全文
摘要:import cv2 from pathlib import Path import numpy as np Workspace = r"F:\pythonProject\测试\bag包测试\color_directory" fourcc = cv2.VideoWriter.fourcc(*"MJP
阅读全文
摘要:import argparse import pyrealsense2 as rs import numpy as np import cv2 import os """ this is a file for convert .bag files to .png files for RealSens
阅读全文
摘要:def img2pdf(img_files, name): doc = fitz.open() for file in img_files: page = doc.new_page() img_doc = fitz.open(file) pdf_bytes = img_doc.convert_to_
阅读全文
摘要:如何使用ffmpy从文件中获取元数据 import subprocess import ffmpy import json tup_resp = ffmpy.FFprobe( inputs={source_path: None}, global_options=[ '-v', 'quiet', '-
阅读全文
摘要:#! /usr/bin/env python # -*- coding: utf-8 -*-# # # Name: num2chinese # Author: yunhgu # Date: 2021/8/24 14:51 # Description: # _MAPPING = (u'零', u'一'
阅读全文
摘要:textgrid文件说明 第一行是固定的:File type = "ooTextFile" 第二行也是固定的:Object class = "TextGrid" 空一行 xmin = xxxx.xxxx # 表示开始时间 xmax = xxxx.xxxx # 表示结束时间 tiers? <exist
阅读全文
摘要:import cv2 import numpy as np parameter_mapping = { # 内参 'internal_reference': [[25714.104851, 0.000000, 1847.417942], [0.000000, 2586.842593, 1152.89
阅读全文
摘要:# -*- coding: utf-8 -*-# # # Name: 点云降维处理 # Author: yunhgu # Date: 2022/1/26 11:17 # Description: # import copy import logging import random import st
阅读全文
摘要:#! /usr/bin/env python # -*- coding: utf-8 -*-# # # Name: 图片模糊度计算 # Author: yunhgu # Date: 2021/8/20 11:01 # Description: # import shutil from traceba
阅读全文
摘要:#! /usr/bin/env python # -*- coding: utf-8 -*-# import re s = "你好2021" content = re.sub(r"(\S+?)(\d+)", r"**\1** ##\2##", s) print(content)
阅读全文
摘要:读取和生成json文件 from json import load,dumps # 读取json文件 def read_json(file_path): file_json = None try: with open(file_path, mode='r', encoding="utf-8") as
阅读全文
摘要:问题 直接使用pyinstaller -F test.py 进行打包,之后运行exe会报错 解决方法 将dat文件打包到exe中 修改spec文件 # -*- mode: python -*- block_cipher = None face_models = [ ('.\\face_recogni
阅读全文
摘要:pyyaml模块 pip install pyyaml 在安装的时候是pyyaml,但是在使用的时候是yaml. 具体使用 #! /usr/bin/env python # -*- coding: utf-8 -*-# # # Name: tools_01 # Author: yunhgu # Da
阅读全文
摘要:问题所在 代码中控制条输出含有中文,引起编码错误 解决 打包的时候去修改gooey源码Libsite-packages/gooey/gui/processor.py def _forward_stdout(self, process): ''' Reads the stdout of `proces
阅读全文
摘要:原字符串左侧对齐, 右侧补零: str.ljust(width,'0') input: '789'.ljust(32,'0') output: '78900000000000000000000000000000' 原字符串右侧对齐, 左侧补零: 方法一: str.rjust(width,'0') i
阅读全文
摘要:def polygon_area(points): """返回多边形面积 """ area = 0 q = points[-1] for p in points: area += p[0] * q[1] - p[1] * q[0] q = p return abs(area / 2)
阅读全文