当前位置:网站首页>Programming record - picture rotation function SciPy ndimage. Simple use and effect observation of rotate()
Programming record - picture rotation function SciPy ndimage. Simple use and effect observation of rotate()
2022-04-23 05:59:00 【umbrellalalalala】
One 、 Effect on matrix
Briefly and comprehensively introduce the use of this function :
import numpy as np
from scipy import ndimage
c = np.zeros([10, 10]).astype(int)
for i in range(10):
for j in range(10):
c[i][j] = 10 * i + j
d = ndimage.rotate(c, 60, reshape=False)
print(c)
print(d)
Output results :
[[ 0 1 2 3 4 5 6 7 8 9]
[10 11 12 13 14 15 16 17 18 19]
[20 21 22 23 24 25 26 27 28 29]
[30 31 32 33 34 35 36 37 38 39]
[40 41 42 43 44 45 46 47 48 49]
[50 51 52 53 54 55 56 57 58 59]
[60 61 62 63 64 65 66 67 68 69]
[70 71 72 73 74 75 76 77 78 79]
[80 81 82 83 84 85 86 87 88 89]
[90 91 92 93 94 95 96 97 98 99]]
[[ 0 0 7 17 27 36 0 0 0 0]
[ 0 0 11 22 30 40 49 58 0 0]
[ 0 6 16 25 35 44 53 62 71 80]
[ 0 10 21 29 39 48 57 66 75 84]
[ 5 16 24 34 43 52 61 70 79 89]
[10 20 29 38 47 56 65 75 83 94]
[15 24 33 42 51 60 70 78 89 0]
[19 28 37 46 55 64 74 83 93 0]
[ 0 0 41 50 59 69 77 88 0 0]
[ 0 0 0 0 63 72 82 92 0 0]]
It can be seen that , after d = ndimage.rotate(c, 60, reshape=False)
after ,d By c Counter clockwise rotation 60 Get by degrees .
Two 、 The effect on the picture
This method can be used on the picture :
ph1 = ndimage.rotate(ph, 60, reshape=False)
plt.subplot(1, 2, 1)
plt.imshow(ph, cmap='gray')
plt.subplot(1, 2, 2)
plt.imshow(ph1, cmap='gray')
plt.show()
The output is as follows :
It can be seen that when calling ph1 = ndimage.rotate(ph, 60, reshape=False)
after , On the right side (ph1) It's the left side (ph) Counter clockwise rotation 60 Degree obtained .
版权声明
本文为[umbrellalalalala]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230543474151.html
边栏推荐
- Font shape `OMX/cmex/m/n‘ in size <10.53937> not available (Font) size <10.95> substituted.
- Multithreading and high concurrency (1) -- basic knowledge of threads (implementation, common methods, state)
- Pytorch Learning record (XIII): Recurrent Neural Network
- PreparedStatement防止SQL注入
- Fundamentals of digital image processing (Gonzalez) I
- 图像恢复论文简记——Uformer: A General U-Shaped Transformer for Image Restoration
- Latex quick start
- JVM family (4) -- memory overflow (OOM)
- Illustrate the significance of hashcode
- JSP语法及JSTL标签
猜你喜欢
多线程与高并发(2)——synchronized用法详解
lambda表达式
PyQy5学习(三):QLineEdit+QTextEdit
filebrowser实现私有网盘
PyEMD安装及简单使用
Dva中在effects中获取state的值
Complete example demonstration of creating table to page - joint table query
Multithreading and high concurrency (2) -- detailed explanation of synchronized usage
Manually delete registered services on Eureka
Conda 虚拟环境管理(创建、删除、克隆、重命名、导出和导入)
随机推荐
The user name and password of users in the domain accessing the samba server outside the domain are wrong
Treatment of tensorflow sequelae - simple example record torch utils. data. dataset. Picture dimension problem when rewriting dataset
深入理解去噪论文——FFDNet和CBDNet中noise level与噪声方差之间的关系探索
In depth source code analysis servlet first program
Postfix变成垃圾邮件中转站后的补救
线代第四章-向量组的线性相关
你不能访问此共享文件夹,因为你组织的安全策略阻止未经身份验证的来宾访问
JDBC连接数据库
Traitement des séquelles du flux de Tensor - exemple simple d'enregistrement de torche. Utils. Données. Dataset. Problème de dimension de l'image lors de la réécriture de l'ensemble de données
类的加载与ClassLoader的理解
多线程与高并发(1)——线程的基本知识(实现,常用方法,状态)
Dva中在effects中获取state的值
Multithreading and high concurrency (2) -- detailed explanation of synchronized usage
Anaconda安装PyQt5 和 pyqt5-tools后没有出现designer.exe的问题解决
Create enterprise mailbox account command
Anaconda
图像恢复论文简记——Uformer: A General U-Shaped Transformer for Image Restoration
Write your own redistemplate
Multithreading and high concurrency (3) -- synchronized principle
umi官网yarn create @umijs/umi-app 报错:文件名、目录名或卷标语法不正确