diff --git a/exp/polar_hough.py b/exp/polar_hough.py --- a/exp/polar_hough.py +++ b/exp/polar_hough.py @@ -1,5 +1,6 @@ import itertools import math +import logging as log import numpy as np import scipy.signal @@ -32,11 +33,11 @@ class PolarHough: def _extractAngles(self,k): lens=np.array(list(map(len,self._acc))) - print(lens) + log.debug(lens) (peakKeys,info)=scipy.signal.find_peaks(lens,prominence=0) res=sorted(zip(info["prominences"],peakKeys),reverse=True)[:k] res=[(key*self._anglePrecision,prominence) for (prominence,key) in res] - print("(angle, prominence):",res,"...",[alpha/self._anglePrecision for (alpha,_) in res]) + log.debug("(angle, prominence): %s ... %s",res,[alpha/self._anglePrecision for (alpha,_) in res]) return res def _mapAngles(self,angles): @@ -53,5 +54,5 @@ class PolarHough: dist=min(dist,self._maxLength) acc[int(dist//self._lengthPrecision)]+=1 res=acc.argmax() - print("(length, count):",(res*self._lengthPrecision,acc[res])) + log.debug("(length, count): %s",(res*self._lengthPrecision,acc[res])) return (res*self._lengthPrecision,acc[res])