- 博客(4)
- 收藏
- 关注
原创 python计算图像的Hu矩和皮尔逊相关系数
用python 加opencv计算两张图像的hu矩和皮尔逊相关系数,输出其相似度。import cv2import mathimport numpy as npfrom PIL import Imageim1 = cv2.imread('xuetaggujia.png',cv2.IMREAD_GRAYSCALE)im2 = cv2.imread('xuegengujia.png',cv2.IMREAD_GRAYSCALE)_,im1 = cv2.threshold(im1, 12
2021-09-29 15:35:46 718
原创 Python oswalk 遍历文件夹中的文件并将文件名存储在txt文件中
# -*- coding: utf-8 -*-import ospath1 = ''def file_name(file_dir): for root, dirs, files in os.walk(file_dir): file = open('trainA.txt', 'w+') for f in files: # print(os.path.join(path1,f)) i = (os.path.jo.
2021-05-26 15:52:01 277
原创 python cv2 实现统计黑白图片中每行的黑白像素点个数
import cv2import numpy as npfrom matplotlib import pyplot as plt# read imageimg = cv2.imread('C:\\Users\\test\\PycharmProjects\\test222\\ziii.png')GrayImage=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)ret,thresh2=cv2.threshold(GrayImage,127,255,cv2.THRESH_.
2021-05-10 15:23:48 2445 6
原创 python+opencv 实现遍历文件夹并对图片中的黑块进行检测
最近在做字体项目的数据集,处理时发现有的图片有黑块如图而正常的图片是没有黑块的如下手动筛选数据量太大了,就写了程序筛选。中心思想就是遍历文件夹,然后逐列检测,遇到某一列像素大于等于黑块的高度就判断其有黑块,并输出“有黑块”使用简单的opencv和python就能完成程序非常简单,但是编写时遇到困难,在于读取单张图片时运行非常顺利,但是在遍历文件夹时却抛出错误ValueError: The truth value of an array with mor...
2021-05-10 15:15:40 1389 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人