![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
图像处理
ziyybs
努力成为技术大佬。加油
展开
-
python获取txt文件某一行
python获取txt某一行原创 2022-06-01 09:30:46 · 2095 阅读 · 1 评论 -
python,生成先验框anchor
python生成先验框anchor原创 2022-06-01 09:25:53 · 302 阅读 · 0 评论 -
python获取视频总帧数和帧率
python获取视频帧率fps和总帧数原创 2022-06-01 09:23:44 · 2880 阅读 · 4 评论 -
视频段随机拼接
# 视频拼接import randomimport osfrom moviepy.editor import *def someof(p_path, n_path): """ 随机选取两个视频 :param p_path: p的path :param n_path: n的path :return: one_video """ p_list = [p_path + "\\" + i for i in os.listdir(p_path)].原创 2022-05-31 15:20:34 · 151 阅读 · 0 评论 -
视频取帧python
import osimport cv2path = r'H:\datasets\Positive\video'img_path0 = r'H:\datasets\Positive\img'# os.chdir('视频文件根目录') # 例如f:/video# v_path = 'ghz.mp4'list_video = []for i in os.listdir(path): list_video.append(os.path.join(path, i))for m in l.原创 2022-05-31 15:17:40 · 472 阅读 · 0 评论 -
加载数据集,加载文件夹下所有文件
class LoadImages: def __init__(self, path): if '*' in path: files = sorted(glob.glob(path, recursive=True)) # glob elif os.path.isdir(path): files = sorted(glob.glob(os.path.join(path, '*.*'))) # dir e.原创 2022-05-24 09:42:51 · 399 阅读 · 0 评论 -
xml转txt格式标注数据
import xml.etree.ElementTree as ETimport osfrom os import getcwdfrom os.path import joinimport globclasses = ['pig'] # 标注时的标签def convert(size, box): dw = 1. / size[0] dh = 1. / size[1] x = (box[0] + box[1]) / 2.0 y = (box[2] + bo.原创 2022-05-18 09:06:43 · 141 阅读 · 0 评论 -
python,修改txt每行部分内容
txt修改,python原创 2022-05-16 09:12:30 · 1158 阅读 · 0 评论 -
深度学习,数据增强批量处理代码。
import xml.etree.ElementTree as ETimport pickleimport osfrom os import getcwdimport numpy as npfrom PIL import Imageimport shutilimport matplotlib.pyplot as pltimport imgaug as iafrom imgaug import augmenters as iaaia.seed(1)def read_xml_an.原创 2022-04-22 09:48:27 · 864 阅读 · 1 评论 -
python导包时check_hostname requires server_hostname问题
pycharm导包时发现自动导包失败from labelme import utils这也是pycharm一直存在的问题了于是在Terminal使用pip导包,结果报错。 File "C:\Users\Doris\Anaconda3\envs\pytorch\lib\ssl.py", line 807, in _create raise ValueError("check_hostname requires server_hostname")ValueError: che.原创 2021-10-20 15:24:10 · 486 阅读 · 0 评论 -
图像几何变化
1.图像裁剪import cv2import numpy as npimg = cv2.imread('lena.jpg')cv2.imshow('lena.jpg', img)cv2.waitKey(0)print(img.shape) # (200,200,3)img_cut = img[30:200, 30:200]cv2.imwrite('img_cut.jpg', img_cut)结果:原创 2021-08-20 14:33:50 · 579 阅读 · 0 评论 -
图像亮度和对比度转化
# 原理:g(i,j) = af(i,j) + b。 其中a对像素点对比度增强,b对像素点亮度增强。import cv2import numpy as npdef convert_img(img, alpha, beta): black = np.zeros(img.shape, img.dtype) return cv2.addWeighted(img, alpha, black, 0, beta)img = cv2.imread("lena.jpg")cv2.imsh.原创 2021-08-20 14:17:21 · 129 阅读 · 0 评论 -
图像负片处理
import cv2import numpy as np# 读取图片img = cv2.imread('lena.jpg')cv2.imshow('lena', img)cv2.waitKey(0) # 持续函数print(img)height = img.shape[0]width = img.shape[1]negative_file = np.zeros((height, width, 3))# BGR图像拆分为3通道b, g, r = cv2.split(img).原创 2021-08-20 13:52:51 · 644 阅读 · 0 评论