随笔分类 - python
摘要:import scanpy as sc import scipy # from scipy.sparse import csr_matrix # import scipy.sparse import numpy as np import time # 记个运行时长 start = time.perf
阅读全文
摘要:import osimport cv2img = cv2.imread("./test.bmp")# 转成透明度图片img = cv2.cvtColor(img, cv2.COLOR_BGR2BGRA)width, height, channel = img.shapefor i in range(
阅读全文
摘要:描述:用来执行定时任务(异步),点个赞不过分吧 # 计时器类(异步) # time: 间隔时间(秒), 毫秒请使用小数(0.1xxxx) # handle: 要进行的异步处理器(名称) # arg: 异步处理器的参数(元组) class setInteval(threading.Thread): d
阅读全文
摘要:思想:跟家里铺瓷砖的想法是一样的 给出大矩形的宽高:width, height 切块的宽高:span(width, height) def slice_rectangle(width, height, span): shape = [0, 0] # 高宽 blocks = [] # (lx,ly)
阅读全文
摘要:def getConnectedNum(mat): cnt = 0 h = len(mat) for i in range(h): w = len(mat[i]) for j in range(w): if mat[i][j] == 0: cnt = cnt + 1 seekConnected(ma
阅读全文
摘要:参考博客: https://www.cnblogs.com/zhangjiansheng/p/6925722.html # coding=gbk from PIL import Image # 灰度策略 def strategy_avg(r, g, b): return int((r + g + b
阅读全文