---
# System prepended metadata

title: Python 圖片三維 歸一化 範例
tags: [Python, ' Matplotlib']

---

---
tags: Python, Matplotlib
---

# Python 圖片三維 歸一化 範例

[![hackmd-github-sync-badge](https://hackmd.io/0OrmNhMNTtqqun5YpfWqUg/badge)](https://hackmd.io/0OrmNhMNTtqqun5YpfWqUg)


## 正常圖片
![](https://i.imgur.com/rlBncbH.jpg =360x360)![](https://i.imgur.com/XfIXTfh.jpg =360x360)

```
[r] --> mean:90.9986328125, max:255, min:3, std:69.60828455996311
[g] --> mean:81.1236328125, max:255, min:10, std:46.28217364969123
[b] --> mean:66.13603515625, max:236, min:0, std:39.021452812427604
```


## StandardScaler
![](https://i.imgur.com/UYe5PLW.jpg =360x360)![](https://i.imgur.com/u0FdBWj.jpg =360x360)

```
[R] --> mean:-2.2204460492503132e-17, max:5.1776200102980585, min:-2.57209274016611, std:1.0
[G] --> mean:2.2204460492503132e-17, max:5.394361900496917, min:-3.2298476454285807, std:0.9999999999999999
[B] --> mean:-5.551115123125783e-18, max:4.827169838455664, min:-3.0250831044815745, std:1.0
```




## MinMaxScaler
![](https://i.imgur.com/8Gsx9tf.jpg =360x360)![](https://i.imgur.com/nAXubt6.jpg =360x360)

```
[R] --> mean:0.367306585918676, max:1.0000000000000002, min:0.0, std:0.3201777499082265
[G] --> mean:0.36659015015283847, max:1.0000000000000002, min:0.0, std:0.2574343319172839
[B] --> mean:0.38377992854524123, max:1.0000000000000002, min:0.0, std:0.24174371995212154
```
## scale
![](https://i.imgur.com/bSZAepe.jpg =360x360)![](https://i.imgur.com/MlYRQFL.jpg =360x360)

```
[R] --> mean:-2.2204460492503132e-17, max:5.1776200102980585, min:-2.57209274016611, std:1.0
[G] --> mean:2.2204460492503132e-17, max:5.394361900496917, min:-3.2298476454285807, std:0.9999999999999999
[B] --> mean:-5.551115123125783e-18, max:4.827169838455664, min:-3.0250831044815745, std:1.0
```

![](https://i.imgur.com/TRqRKAI.jpg =360x360)![](https://i.imgur.com/0jb61w8.jpg =360x360)

```
[R] --> mean:3.122502256758253e-18, max:3.5791893286345076, min:-3.1753650900868413, std:0.9999999999999999
[G] --> mean:1.3530843112619095e-17, max:3.9542682862440173, min:-2.726577913077065, std:1.0
[B] --> mean:2.8102520310824274e-17, max:4.1417084978012495, min:-2.2925224310021464, std:1.0
```

## normalize
![](https://i.imgur.com/sVewhHy.jpg =360x360)![](https://i.imgur.com/o2lOlIM.jpg =360x360)

```
[R] --> mean:0.0125, max:0.030414520480745645, min:0.001053370786516854, std:0.005051403564341243
[G] --> mean:0.0125, max:0.03527244011581995, min:0.0013317191283292978, std:0.005386292908678227
[B] --> mean:0.0125, max:0.0390104662226451, min:0.0, std:0.006183696099069608
```

![](https://i.imgur.com/3dpqjJe.jpg =360x360)![](https://i.imgur.com/J5q66uD.jpg =360x360)

```
[R] --> mean:0.10387969539422515, max:0.24128112031909882, min:0.008334876972011636, std:0.041340160677034124
[G] --> mean:0.10305362427588045, max:0.2768128321785667, min:0.01031618990672521, std:0.04335839622963082
[B] --> mean:0.10107137553820614, max:0.2942659520949449, min:0.0, std:0.047797249364528366
```

![](https://i.imgur.com/uxvo1vE.jpg =360x360)![](https://i.imgur.com/OW1EZv2.jpg =360x360)

```
[R] --> mean:0.5689226975074033, max:1.0, min:0.03529411764705882, std:0.24100060561798878
[G] --> mean:0.5563046351408472, max:1.0, min:0.05583756345177665, std:0.2421883862130015
[B] --> mean:0.5244903376399873, max:1.0, min:0.0, std:0.2533791433346513
```

## QuantileTransformer
![](https://i.imgur.com/XNQaSlO.jpg =360x360)![](https://i.imgur.com/5bzREiu.jpg =360x360)

```
[R] --> mean:0.037020400718485294, max:5.19933758270342, min:-5.199337582605575, std:1.3045725976139817
[G] --> mean:-0.0004503177530951363, max:5.19933758270342, min:-5.199337582605575, std:1.2492888226620873
[B] --> mean:-0.019917198259513845, max:5.19933758270342, min:-5.199337582605575, std:1.2361959934980373
```

![](https://i.imgur.com/YsVnbSI.jpg =360x360)![](https://i.imgur.com/XNQ1VfK.jpg =360x360)

```
[R] --> mean:0.5006770833333334, max:1.0, min:0.0, std:0.2918440550659816
[G] --> mean:0.5000597215387139, max:1.0, min:0.0, std:0.291053156302859
[B] --> mean:0.5000107139927822, max:1.0, min:0.0, std:0.29107035005978477
```