Skip to content

Commit

Permalink
Set rotsym as an explicit argument in symmetrize.sym._symcentcost()
Browse files Browse the repository at this point in the history
  • Loading branch information
RealPolitiX committed Jan 11, 2019
1 parent 246d4d6 commit 2df9438
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions symmetrize/sym.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def _refset(coeffs, landmarks, center, direction=1, include_center=False):
return lmkwarped, H


def _refsetcost(coeffs, landmarks, center, mcd, med, direction=-1, weights=(1, 1, 1), include_center=False):
def _refsetcost(coeffs, landmarks, center, mcd, med, direction=-1, rotsym=6, weights=(1, 1, 1), include_center=False):
"""
Reference point set generator cost function.
Expand All @@ -241,18 +241,18 @@ def _refsetcost(coeffs, landmarks, center, mcd, med, direction=-1, weights=(1, 1
"""

landmarks_warped, _ = _refset(coeffs, landmarks, center, direction=direction, include_center=include_center)
rs_cost = _symcentcost(landmarks_warped, center, mcd, med, weights=weights)
rs_cost = _symcentcost(landmarks_warped, center, mcd, med, rotsym, weights=weights)

return rs_cost


def refsetopt(init, pts, center, mcd, med, niter=200, direction=-1, weights=(1, 1, 1),
def refsetopt(init, pts, center, mcd, med, niter=200, direction=-1, rotsym=6, weights=(1, 1, 1),
method='Nelder-Mead', include_center=False, **kwds):
""" Optimization to find the optimal reference point set.
"""

res = opt.basinhopping(_refsetcost, init, niter=niter, minimizer_kwargs={'method':method,\
'args':(pts, center, mcd, med, direction, weights, include_center)}, **kwds)
'args':(pts, center, mcd, med, direction, rotsym, weights, include_center)}, **kwds)
# Calculate the optimal warped point set and the corresponding homography
ptsw, H = _refset(res['x'], pts, center, direction, include_center)

Expand Down

0 comments on commit 2df9438

Please sign in to comment.