月光魔草

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2020年7月18日

摘要: with open("time_and_location.txt", "r") as f: k=0 old="20180801002244172.000000_65.113129_-138.730759" for line in f.readlines(): k+=1 if(k>553863): l 阅读全文
posted @ 2020-07-18 11:32 月光魔草 阅读(656) 评论(0) 推荐(0) 编辑

2020年6月23日

摘要: 常见的有三种,日期元祖、time与datetime 调用源码如下: y=datetime.datetime(int(get_data[7][0:4]),int(get_data[7][4:6]),int(get_data[7][6:8]),int(get_data[8][0:2]),int(get_ 阅读全文
posted @ 2020-06-23 21:09 月光魔草 阅读(1783) 评论(0) 推荐(0) 编辑

摘要: 对应python3以上的版本: 需要在pip上安装pymysql的包,我在引入这个包时遇到了无法引入的情况,No module named 'PyMySQL' 查了一遍之后,应该是pip解释器和编码用的不一致导致。 解决方案: 将此路径下文件拷贝到编译器环境即可(缺省拷贝,不用覆盖,可能会多拷一些东 阅读全文
posted @ 2020-06-23 12:26 月光魔草 阅读(114) 评论(0) 推荐(0) 编辑

2020年6月14日

摘要: 首先,导入一组数据,代码如下: import numpy as np import matplotlib.pyplot as plt x, y = [], [] for sample in open("../_Data/prices.txt", "r"): _x, _y = sample.split 阅读全文
posted @ 2020-06-14 17:39 月光魔草 阅读(420) 评论(0) 推荐(0) 编辑

2020年6月13日

摘要: 以下是坐标系内画圆: import cv2 as cv import matplotlib.pyplot as plt circlel=plt.Circle((0.4,0.4),0.2,color='r') fig,ax=plt.subplots() ax.add_artist(circlel) f 阅读全文
posted @ 2020-06-13 19:01 月光魔草 阅读(146) 评论(0) 推荐(0) 编辑

2020年6月11日

摘要: 首先引入包,matplotlib,据说可以绘制各种几何图,甚至3D立体图 以下是直方图绘制方法 import matplotlib.pyplot as pltimport numpy as np x=np.random.randint(0,100,100)#生成【0-100】之间的100个数据plt 阅读全文
posted @ 2020-06-11 10:46 月光魔草 阅读(163) 评论(0) 推荐(0) 编辑

2020年6月10日

摘要: 平移: 遍历像素即可,也可以用函数[ : , m:n ] w,h,m= img.shape dst = np.zeros((w,h,m), np.uint8) for i in range(w-50): for j in range( h-60): dst[i+50, j+60] = img[i, 阅读全文
posted @ 2020-06-10 22:12 月光魔草 阅读(349) 评论(0) 推荐(0) 编辑

摘要: 图像三原色分离,叫做RGB通道(愈发的感觉像是PS中的图像处理,不过我们是用代码实现的),效果图如下: 染色前: 染色后: 代码如下: def RBG(src): b,g,r=cv2.split(src) cv2.imshow("b",b) cv2.imshow("g",g) cv2.imshow( 阅读全文
posted @ 2020-06-10 15:17 月光魔草 阅读(204) 评论(0) 推荐(0) 编辑

摘要: # -*-coding:utf-8 -*- import cv2 as cv #打开图片 img=cv.imread("08.png") #cv.imshow("la",img) #变灰 gray=cv.cvtColor(img, cv.COLOR_RGB2GRAY) #cv.imshow("gra 阅读全文
posted @ 2020-06-10 14:22 月光魔草 阅读(2789) 评论(0) 推荐(0) 编辑

2020年6月9日

摘要: 逆序数: 进行冒泡排序,统计期间交换次数 import copy e =[[1,3,1], [2,1,0], [2,0,1]] #求逆序数/冒泡法 def inverse_number(e): a=copy.deepcopy(e) c = [0,0,0] for n in range(len(a)) 阅读全文
posted @ 2020-06-09 17:56 月光魔草 阅读(277) 评论(0) 推荐(0) 编辑