Skip to content

Commit

Permalink
V2.0 Beta
Browse files Browse the repository at this point in the history
  • Loading branch information
ddowd97 committed Jun 14, 2021
1 parent 11a0292 commit 11ee04b
Show file tree
Hide file tree
Showing 5 changed files with 4,971 additions and 2,920 deletions.
7 changes: 2 additions & 5 deletions Morphing/Morphing.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
#######################################################
# Author: David Dowd
# Email: [email protected]
# Author: David Dowd
# Email: [email protected]
#######################################################

import os
import copy
from PIL import Image, ImageDraw
from scipy.spatial import Delaunay # pip install scipy
from scipy.interpolate import RectBivariateSpline # pip install scipy
from matplotlib.path import Path # pip install matplotlib
import numpy as np # pip install numpy
import itertools

# Module level Variables
#######################################################
Expand Down Expand Up @@ -126,7 +124,6 @@ def interpolatePoints(self, leftTriangle, rightTriangle, alpha):
rightYParam = np.arange(np.amin(rightTriangle.vertices[:, 0]), np.amax(rightTriangle.vertices[:, 0]), 1)
rightImageValues = self.rightImage[int(rightXParam[0]):int(rightXParam[-1] + 1), int(rightYParam[0]):int(rightYParam[-1] + 1)]

# This is where performance skyrockets. Again, credit goes to zhifeichen097 for discovering the .ev() method!
self.newLeftImage[xp, yp] = RectBivariateSpline(leftXParam, leftYParam, leftImageValues, kx=1, ky=1).ev(leftXValues, leftYValues)
self.newRightImage[xp, yp] = RectBivariateSpline(rightXParam, rightYParam, rightImageValues, kx=1, ky=1).ev(rightXValues, rightYValues)
except:
Expand Down
Loading

0 comments on commit 11ee04b

Please sign in to comment.