function E = ComputeEnergy_sol(img)
    E = zeros(size(img,1),size(img,2));
    G_x = [1 0 -1; 2 0 -2; 1 0 -1];
    G_y = [1 2 1; 0 0 0; -1 -2 -1];
    
    for color = 1:3
       E = E + abs(filter2(G_x, img(:,:,color))) + abs(filter2(G_y, img(:,:,color))); 
    end

end
