class RenderDOG: def __init__(self): self.dog = DetectorDOG() def __call__(self, im): tmp = im.asPIL() tmp = tmp.resize((160, 120)) tmp = Image(tmp) points = self.dog.detect(tmp) for score, pt, radius in points: pt = Point(pt.X() * 4, pt.Y() * 4) im.annotateCircle(pt, radius * 4) return im
class RenderDOG: def __init__(self): self.dog = DetectorDOG() def __call__(self,im): tmp = im.asPIL() tmp = tmp.resize((160,120)) tmp = Image(tmp) points = self.dog.detect(tmp) for score,pt,radius in points: pt = Point(pt.X()*4,pt.Y()*4) im.annotateCircle(pt,radius*4) return im
def __init__(self, parent, id, name, demos=DEMO_DEFAULTS, size=(800, 550)): wx.Frame.__init__(self, parent, id, name, size=size) # ---------------- Basic Data ------------------- self.webcam = Webcam() self.harris = DetectorHarris() self.dog = DetectorDOG(n=100, selector='best') self.face = CascadeDetector() self.demos = demos # ------------- Other Components ---------------- self.CreateStatusBar() # ------------------- Menu ---------------------- # Creating the menubar. # ----------------- Image List ------------------ # --------------- Image Display ----------------- self.static_bitmap = wx.StaticBitmap(self, wx.NewId(), bitmap=wx.EmptyBitmap(640, 480)) self.radios = wx.RadioBox(self, wx.NewId(), 'Demos', choices=['None'] + self.demos.keys(), style=wx.RA_SPECIFY_ROWS) self.mirror = wx.CheckBox(self, wx.NewId(), 'Mirror') self.mirror.SetValue(True) # --------------- Window Layout ----------------- grid = wx.FlexGridSizer(2, 2) grid.Add(self.static_bitmap) grid.Add(self.radios) grid.Add(self.mirror) self.SetAutoLayout(True) self.SetSizer(grid) self.Layout() # ----------------------------------------------- self.timer = FrameTimer(self) self.timer.Start(200) # -------------- Event Handleing ---------------- wx.EVT_SIZE(self.static_bitmap, self.onBitmapResize) wx.EVT_LEFT_DOWN(self.static_bitmap, self.onClick) wx.EVT_TIMER(self, -1, self.onTmp)
def __init__(self): self.dog = DetectorDOG()
im.show() ilog.log(im) mat = im.asMatrix2D() high = mat > 180 low = mat < 50 mask = high#+low edges = canny(im,100,200) ilog.log(edges) ilog.log(Image(1.0*mask)) e = edges.asPIL().convert('RGB') m = Image(1.0*mask).asPIL() i = im.asPIL() logo = Image(composite(i,e,m)) ilog.log(logo) #sys.exit() sm = Image(im.asPIL().resize((320,240),LINEAR)) detector = DetectorDOG() points = detector.detect(sm) for score,pt,radius in points: logo.annotateCircle(pt*4,radius*4) ilog.log(logo) ilog.show()