
空间艺术Raumkunst
文章平均质量分 54
二、三维计算机图形学,进而扩展至大数据的维度相关知识和代码集合。
飞行codes
资浅程序员,博士
展开
-
opencv图像填充
图像填充函数用法速查原创 2022-11-17 16:42:53 · 1218 阅读 · 1 评论 -
opencv_python画椭圆和封闭多变形
参数速查原创 2022-07-01 18:24:54 · 1106 阅读 · 0 评论 -
opencv外接最小面积长方形
boxes原创 2022-07-01 17:45:22 · 1265 阅读 · 0 评论 -
证明2D-FFT不能够向量重排列后1D-FFT
np.fft.fft原创 2019-02-14 14:38:01 · 353 阅读 · 0 评论 -
cv2.line()命令例子
cv2.line原创 2021-06-26 09:55:13 · 380 阅读 · 0 评论 -
python调节图像明暗亮度
彩色和灰度图像明暗调节解决方案原创 2021-04-14 13:57:59 · 6454 阅读 · 1 评论 -
opencv制作和存储视频avi(python)
假设k张图片序列存在数组(张量)frames:512×512×3×k,如何制作成视频,并另存为avi?import cv2videoWriter = cv2.VideoWriter('MySaveVideo.avi', cv2.VideoWriter_fourcc('I', '4', '2', '0'), 20, (512,512))for i in range(20): temp = frames[:,:,:,i] cv2.imshow('a',temp) v原创 2020-12-23 12:40:30 · 1447 阅读 · 0 评论 -
k-means clustering原理与举例
图像聚类一般是灰度值的聚类。import numpy as npimport cv2img = cv2.imread('differential geometry.jpeg')img2 = img.reshape((-1,3))# convert to np.float32img2 = np.float32(img2)# define criteria, number of...原创 2019-12-30 17:52:13 · 496 阅读 · 0 评论 -
np.mgrid(),np.meshgrid()与三维画图
import numpy as npX = np.mgrid[-5:5:5]X1 = np.mgrid[-5:5:5j]Y1,Y2 = np.mgrid[-5:5,10:17]Z1,Z2,Z3 = np.mgrid[-5:5,10:17,1:3]print(X)print(X1)print(Y1,Y2)输出:[-5 0][-5. -2.5 0. 2.5...原创 2018-11-27 18:23:07 · 5121 阅读 · 0 评论 -
python跳出双循环break图例
用for else语句。import matplotlib.pyplot as pltfig, ax = plt.subplots()for i in range(10): for j in range(10): ax.plot(i, j,'o') if i == 5 and j == 3: break else:...原创 2019-12-30 15:23:52 · 1680 阅读 · 0 评论 -
tensorflow的axis——降维tf.argmax() tf.reduce_mean()
目录tf.argmax() tf.reduce_mean()tf.argmax(), 自带降低一维import tensorflow as tfimport numpy as npx = np.ones((2,3,3,1))z = tf.argmax(x,axis = 3)print(z.get_shape())with tf.Session() as sess: ...原创 2019-06-13 17:20:57 · 280 阅读 · 0 评论 -
python图像处理opencv包大型指导
二值化 cv2.thresholdimport cv2import numpy as npimg = cv2.imread('Hydrogen_Density_Plots.png',0)threshold = 10maxvalue = 157print(np.amax(img))ret_otsu,thresh1 = cv2.threshold(img,threshold,maxv...原创 2019-07-26 16:21:49 · 260 阅读 · 0 评论 -
tf.tile()其实就是贴瓷砖
tf.tile( input, multiples, name=None)Args:input: ATensor. 1-D or higher. multiples: ATensor. Must be one of the following types:int32,int64. 1-D. Length must be the same as the ...原创 2019-07-29 10:38:17 · 436 阅读 · 0 评论 -
python图像大小缩放使用cv2.resize()或scipy.ndimage.zoom()
import cv2tile = cv2.resize(tile,(int(Ximageorg/256),int(Yimageorg/256)),interpolation=cv2.INTER_CUBIC) import scipy from keras.preprocessing import image import matplotlib.pyplot as pltim...原创 2019-07-26 09:26:17 · 4205 阅读 · 0 评论 -
python图像convert()
convert()convert()是图像实例对象的一个方法,接受一个 mode 参数,用以指定一种色彩模式1 ------------------(1位像素,黑白,每字节一个像素存储)L ------------------(8位像素,黑白)P ------------------(8位像素,使用调色板映射到任何其他模式)RGB------------------(3x8位像素,真彩色)RG...原创 2019-07-25 16:27:05 · 3458 阅读 · 0 评论 -
张量升维技巧np.expand_dims(), np.reshape(),np.concatenate()
from keras.preprocessing import image import matplotlib.pyplot as pltimport cv2import numpy as npimg_path = '/Parthenon.jpg'im2 = image.load_img(img_path, target_size=(224, 224))img = image....原创 2019-07-18 15:57:35 · 1970 阅读 · 0 评论 -
python实现矢量积、叉积、外积、张量积
张量积 一般指的是Kronecker product a⊗b很显然,该运算不遵守交换律。import numpy as npa = np.eye(3)b = np.ones((3,2,3))c = np.kron(a,b)aarray([[ 1., 0., 0.], [ 0., 1., 0.], [ 0., 0., 1.]])...原创 2019-04-02 11:14:48 · 36302 阅读 · 0 评论 -
python图像平移
纺射+插值原创 2019-04-26 11:17:36 · 1616 阅读 · 0 评论 -
python图像水平翻转
import numpy as npimport matplotlib.pyplot as pltimport nibabel as nibimport cv2ds = nib.load(image_path)img2 = ds.get_fdata()plt.figure()plt.imshow(img2,'gray')plt.title('scr')#rotateh...原创 2019-04-22 14:26:03 · 3939 阅读 · 0 评论 -
python图像旋转
import cv2img = cv2.imread('wintercome.jpeg')rows,cols,_ = img.shapeh = min(rows,cols)img = img[0:h,0:h]mat = cv2.getRotationMatrix2D((h/2,h/2),90,1)dst = cv2.warpAffine(img,mat,(h,h))cv2.i...原创 2019-04-17 12:45:26 · 1364 阅读 · 0 评论 -
numpy和matlab思维差异
目录numpy核心对象是多维数组 方括号的深度 numpy数组怎么index 举例:高频函数画图numpy核心对象是多维数组numpy 可以说并没有矩阵的概念,它的核心思维方式是多维数组。>>> np.zeros((256,256)) #产生一个256×256的全0矩阵需要两个括号,行列均需赋值。或>>> np.zeros([256...原创 2018-12-28 11:15:38 · 615 阅读 · 0 评论 -
python 画直线和平面
画直线from mpl_toolkits.axisartist.axislines import SubplotZeroimport matplotlib.pyplot as pltimport numpy as npfig = plt.figure(1)ax = SubplotZero(fig, 111)fig.add_subplot(ax)for direction in...原创 2019-04-01 09:22:32 · 7558 阅读 · 0 评论 -
python 基于opencv画方框和圆
参数问题原创 2019-01-25 18:20:26 · 9286 阅读 · 5 评论 -
python+opencv图像长宽xy和屏幕的对应
左上角是原点原创 2018-12-05 10:11:42 · 6973 阅读 · 3 评论 -
numpy.stack()系列
numpy.vstackStack arrays in sequence vertically (row wise).numpy.dstackStack arrays in sequence depth wise (along third axis).stackJoin a sequence of arrays along a new axis.vstackStack ...原创 2019-07-05 17:21:27 · 518 阅读 · 0 评论 -
彩色图像技术重要函数cv2.addWeighted()
两幅图size、channel、归一化格式都相同,那么import cv2import numpy as npimg1 = cv2.imread('lena.jpeg')img2 = cv2.imread('monalisa.jpg')w,h,channel = np.shape(img1)img2 = cv2.resize(img2,(h,w),interpolation...原创 2018-11-20 09:36:17 · 4091 阅读 · 0 评论 -
颜色空间探究:RGB、HSV和HSL
从RGB空间说起所谓RGB空间就是red,green和blue颜色3个向量张成的空间,正好类似于3维欧氏空间。如图所示,3个向量均归一化了,其中(0,0,0)处为黑色,(1,1,1)处为白色。这种映射关系和光学棱镜色散和叠加相对应。实际应用常用的在[0, 255]区间编码。简单的例子:RGB空间(0,0,255)为纯蓝色,(255,0,0)为纯红色。举栗import cv...原创 2018-10-24 17:02:22 · 2240 阅读 · 0 评论 -
tf.stack() 自带升一维
Stacks a list of rank-Rtensors into one rank-(R+1)tensor.import tensorflow as tfa = tf.constant([[1,2,3],[4,5,6]]) b = tf.constant([[7,8,9],[10,11,12]])ab1 = tf.stack([a,b],axis=0)ab2 = tf.st...原创 2019-06-13 17:57:24 · 270 阅读 · 0 评论 -
高端索引tf.gather_nd(params, indices)
import tensorflow as tfimport numpy as npparams = np.arange(23)a = tf.gather(params,1)with tf.Session() as sess: print(sess.run(a)) params = np.arange(24).reshape(2,-1)a = tf.gather(pa...原创 2019-06-13 17:36:26 · 426 阅读 · 0 评论 -
分形可视化tensorflow实现
In mathematics, a fractal is a detailed, recursive, and infinitely self-similar mathematical set. import tensorflow as tfimport numpy as np# 导入可视化库import PIL.Imagefrom cStringIO import Strin...转载 2018-11-08 10:35:41 · 479 阅读 · 1 评论 -
Python心法:numpy命令关于axis=0,axis=1,axis=2
二维数组情形例1mu = np.mean(features,axis=0)features为M×N, 那么mu为(N,)或记1×N例2X_input = np.concatenate((features,intercept_feature),axis=1)features为M×N,那么X_input为M ×(N+1)例3>>> a = n...原创 2018-10-23 17:19:00 · 10666 阅读 · 1 评论