![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
文章平均质量分 52
xinfeng2005
这个作者很懒,什么都没留下…
展开
-
PIL Image resize methods
NEAREST从输入图像中选择一个最近的像素。忽略所有其他输入像素。BILINEAR (推荐)若要调整大小,请对所有可能影响输出值的像素使用线性插值计算输出像素值。对于其他变换,使用输入图像中2x2环境上的线性插值。BICUBIC若要调整大小,请对所有可能影响输出值的像素使用三次插值计算输出像素值。对于其他变换,在输入图像中使用4x4环境上的三次插值。...原创 2021-07-16 09:43:32 · 200 阅读 · 0 评论 -
shapely 多边形缩放
from shapely.geometry import Polygon, Point, LinearRingimport cv2import numpy as npxx = [(10, 10), (12,100), (100, 100), (20,20), (20,10)]poly = Polygon(xx)a = poly.buffer(-31)print(len(list(a.exterior.coords)))img = np.zeros((200,200,3), dtype=np..原创 2020-09-02 10:18:33 · 1291 阅读 · 0 评论 -
python正则re使用
1、import re# 将正则表达式编译成Pattern对象pattern = re.compile(r'hello',re.I)# 使用Pattern匹配文本,获得匹配结果,无法匹配时将返回Nonematch = pattern.match('hello world!')if match:# 使用Match获得分组信息print match.group(原创 2018-01-05 08:11:16 · 611 阅读 · 0 评论 -
python实现viterbi算法
states = ('Healthy', 'Fever')observations = ('normal', 'cold', 'dizzy')start_probability = {'Healthy': 0.6, 'Fever': 0.4}transition_probability = { 'Healthy': {'Healthy': 0.7, 'Fever': 0.3},原创 2018-01-10 15:17:22 · 994 阅读 · 0 评论 -
PyAutoGUI自动控制鼠标和键盘操作
https://muxuezi.github.io/posts/doc-pyautogui.html转载 2018-01-17 10:03:40 · 673 阅读 · 0 评论 -
python使用cv2进行face detect
import cv2import sys# Get user supplied valuesimagePath = 'data/0.jpg' #sys.argv[1]cascPath = 'haarcascades/haarcascade_frontalcatface.xml' #sys.argv[2]cascPath = 'haarcascades/haarcascade_front...原创 2018-03-22 10:38:24 · 1567 阅读 · 0 评论 -
python mutiprocessing使用
帮助文档:点击打开链接mutiprocessing.Process=单进程,多进程 mutiprocessing.Lock=进程锁 mutiprocessing.Semaphore=N锁 Pool.apply_async=得到返回结果 Pool.map=批量进程import multiprocessingimport cv2def f(x): return x*2 # img ...原创 2018-05-04 11:24:24 · 425 阅读 · 0 评论 -
python基于dlib的人脸定位与人脸比对实现
import dlibcurrent_path = os.getcwd() # 获取当前路径# 模型路径predictor_path = current_path + "\\model\\shape_predictor_68_face_landmarks.dat"face_rec_model_path = current_path + "\\model\\dlib_face_recognitio...原创 2018-05-05 09:39:35 · 5477 阅读 · 0 评论 -
python 多模式匹配自动机
# 结点类class node: def __init__(self, ch): self.ch = ch # 结点值 self.fail = None # Fail指针 self.tail = 0 # 尾标志:标志为 i 表示第 i 个模式串串尾 self.child = [] # 子结点 self...原创 2018-05-29 15:50:44 · 1215 阅读 · 0 评论 -
python to exe pyinstaller
pyinstaller -F -w -i manage.ico test.py -n test.exe-F:打包为单文件-w:Windows程序,不显示命令行窗口-i:是程序图标,test.py是你要打包的py文件*注意*:如果出现以下错误:ImportError: No module named 'h5py.defs'则:pyinstaller --hidden-import=h...原创 2017-03-11 17:06:18 · 1066 阅读 · 0 评论 -
fld to xml and xml to fld
#coding=utf-8#将fld框文件生成xml'''VOC20122007_000027.jpgThe VOC2007 DatabasePASCAL VOC2007flickr48650030personUnspecified00174101349351'''i原创 2017-06-27 13:49:53 · 369 阅读 · 0 评论 -
win7 远程配置ubuntu14 python keras tensorflow 深度学习
1.远程工具XShell5(远程命令行)+XFTP5(文件传输)2.命令行安装python3.5sudo add-apt-repository ppa:fkrull/deadsnakes sudo apt-get update sudo apt-get install python3.5原创 2017-05-10 16:41:22 · 383 阅读 · 0 评论 -
python opencv cv2 基础操作1
#coding=utf-8import cv2 #cv2.__version__==3.2.0import numpy as np#读取,显示,写# img=cv2.imread('test1.jpg',cv2.IMREAD_ANYCOLOR)# # cv2.imshow('show', img)# print(np.shape(img))# # cv2.waitKey()...原创 2017-04-01 08:58:18 · 8101 阅读 · 0 评论 -
python opencv cv2 基础操作2
#coding=utf-8import cv2 #cv2.__version__==3.2.0import numpy as np#2D convolution: Blurring[1/9 1/9 1/9 1/9 1/9 1/9 1/9 1/9 1/9 ]# img=cv2.imread('test1.jpg',cv2.IMREAD_ANYCOLOR)# rows, col原创 2017-04-13 10:10:33 · 4162 阅读 · 0 评论 -
python opencv cv2 基础操作3 CascadeClassifier
#coding=utf-8import cv2 #cv2.__version__==3.2.0import numpy as np#Detect face# face_cascade =cv2.CascadeClassifier('./data/haarcascades/haarcascade_frontalface_alt.xml')# scaling_factor = 1#原创 2017-04-13 10:54:35 · 8647 阅读 · 0 评论 -
python opencv cv2 基础操作4 Extracting Features
#coding=utf-8import cv2 #cv2.__version__==3.2.0import numpy as np#Extracting Features#Detecting the corners# img=cv2.imread('corner.bmp',cv2.IMREAD_ANYCOLOR)# gray = cv2.cvtColor(img,cv2.COL原创 2017-04-13 13:09:32 · 2156 阅读 · 0 评论 -
python cv2 sift match
#coding=utf-8import cv2import numpy as npprint(cv2.__version__)#3.2.0def visualize_matches(image1, keypoints1, image2, keypoints2, matches): m_image = np.array([]) m_image = cv2.drawMatches(原创 2017-04-06 10:24:51 · 2456 阅读 · 0 评论 -
使用keras预训练VGG16模型参数分类图像并提取特征
#coding=utf-8#keras==0.3.0 theano==0.8.0 python==2.7.13from keras.models import Sequentialfrom keras.layers.core import Flatten, Dense, Dropoutfrom keras.layers.convolutional import Convolution2D,原创 2017-04-16 16:51:38 · 19209 阅读 · 9 评论 -
numpy 傅里叶变换与反变换高低通滤波与带通滤波
#coding=utf-8import cv2import numpy as npimport matplotlib.pyplot as pltimg=cv2.imread('test1-angle.jpg',cv2.IMREAD_GRAYSCALE)# f = np.fft.fft2(img)# fshift = np.fft.fftshift(f)# #取绝对值:将复数变化成原创 2017-04-17 14:53:06 · 7516 阅读 · 0 评论 -
(superpixel)超像素分割
https://github.com/cxf2015/slic-python-implementation/commit/59b98988027dfa384310a0f7bf203ce0fa81fd10原创 2017-04-17 14:56:22 · 2473 阅读 · 2 评论 -
python opencv load image and splite train/test set
from sklearn import cross_validationimport cv2def load_image_data(): dir_path=r'E:\' # class_1_path=dir_path+r'\no' # class_2_path=dir_path+r'\other' # class_3_path=dir_path+r'\yes原创 2017-03-31 16:46:00 · 470 阅读 · 0 评论