Action-Units-Heatmaps
Action-Units-Heatmaps copied to clipboard
Heatmap generation
Hello ESanchezLozano
I'm trying to generate Heatmap for new AU is this a correct way ?
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import multivariate_normal
# create a grid of (x,y) coordinates at which to evaluate the kernels
xlim = (0, 63)
ylim = (0, 63)
xres = 64
yres = 64
x = np.linspace(xlim[0], xlim[1], xres)
y = np.linspace(ylim[0], ylim[1], yres)
xx, yy = np.meshgrid(x,y)
x_1 = 10
y_1 = 10
x_2 = 40
y_2 = 40
o_x_1 = 5
o_y_1 = 5
o_x_2 = 5
o_y_2 = 5
A = 1
B = 0.5
f1 = A * np.exp( -( (np.power((xx - x_1),2) / (2*o_x_1**2)) + (np.power((yy - y_1),2) / (2*o_y_1**2)) ) )
f2 = B * np.exp( -( (np.power((xx - x_2),2) / (2*o_x_2**2)) + (np.power((yy - y_2),2) / (2*o_y_2**2)) ) )
zz = f1 + f2
# reshape and plot image
img = zz.reshape((xres,yres))
plt.imshow(img); plt.show()
Hi,
They don't look pretty symmetric in the intensity, do they?
Please do use my @ so that I can realise there's a comment over here
Many thanks