当前位置:网站首页>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
边栏推荐
- 编程记录——图片旋转函数scipy.ndimage.rotate()的简单使用和效果观察
- What is JSON? First acquaintance with JSON
- Illustrate the significance of hashcode
- Anaconda
- JVM系列(3)——内存分配与回收策略
- DBCP使用
- PyQt5学习(一):布局管理+信号和槽关联+菜单栏与工具栏+打包资源包
- RedHat realizes keyword search in specific text types under the directory and keyword search under VIM mode
- Opensips (1) -- detailed process of installing opensips
- 软件架构设计——软件架构风格
猜你喜欢

Font shape `OMX/cmex/m/n‘ in size <10.53937> not available (Font) size <10.95> substituted.

深入源码分析Servlet第一个程序

The user name and password of users in the domain accessing the samba server outside the domain are wrong

Ptorch learning record (XIII): recurrent neural network

类的加载与ClassLoader的理解

Pytorch learning record (XII): learning rate attenuation + regularization

Pyqy5 learning (4): qabstractbutton + qradiobutton + qcheckbox

Graphic numpy array matrix

PreparedStatement防止SQL注入

PyQy5学习(二):QMainWindow+QWidget+QLabel
随机推荐
线性代数第三章-矩阵的初等变换与线性方程组
PyTorch笔记——通过搭建ResNet熟悉网络搭建方式(完整代码)
金蝶EAS“总账”系统召唤“反过账”按钮
EditorConfig
Linear algebra Chapter 2 - matrices and their operations
Package mall system based on SSM
Development environment EAS login license modification
深度学习基础——简单了解meta learning(来自李宏毅课程笔记)
线性代数第二章-矩阵及其运算
对比学习论文——[MoCo,CVPR2020]Momentum Contrast for Unsupervised Visual Representation Learning
Pytorch学习记录(十一):数据增强、torchvision.transforms各函数讲解
事实最终变量与最终变量
Fundamentals of digital image processing (Gonzalez) II: gray transformation and spatial filtering
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
多线程与高并发(1)——线程的基本知识(实现,常用方法,状态)
container
Pytorch learning record (XII): learning rate attenuation + regularization
Pytorch学习记录(七):处理数据和训练模型的技巧
创建企业邮箱账户命令
MySQL realizes master-slave replication / master-slave synchronization