()
| 32 | plt.close('all') |
| 33 | |
| 34 | def get_demo_image(): |
| 35 | # prepare image |
| 36 | delta = 0.5 |
| 37 | |
| 38 | extent = (-3, 4, -4, 3) |
| 39 | x = np.arange(-3.0, 4.001, delta) |
| 40 | y = np.arange(-4.0, 3.001, delta) |
| 41 | X, Y = np.meshgrid(x, y) |
| 42 | Z1 = np.exp(-X ** 2 - Y ** 2) |
| 43 | Z2 = np.exp(-(X - 1) ** 2 - (Y - 1) ** 2) |
| 44 | Z = (Z1 - Z2) * 2 |
| 45 | |
| 46 | return Z, extent |
| 47 | |
| 48 | def get_rgb(): |
| 49 | Z, extent = get_demo_image() |