EyePicker.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:nimo 作者: wolfram2012 项目源码 文件源码
def DisplayImage(self):
        if self.current_image:
            tw = self.static_bitmap.GetSize().GetWidth()
            th = self.static_bitmap.GetSize().GetHeight()
            sw = self.current_image.GetSize().GetWidth()
            sh = self.current_image.GetSize().GetHeight()

            #self.scale = min(tw/float(sw),th/float(sh))


            tw = int(sw*self.scale)
            th = int(sh*self.scale)

            im = self.current_image.Copy()
            im.Rescale(tw,th)
            bm = im.ConvertToBitmap()  
            bmdc = wx.MemoryDC(bm)
            bmdc.SetBrush(wx.TRANSPARENT_BRUSH)
            bmdc.SetPen(wx.RED_PEN)
            bmdc.SetTextForeground(wx.RED)

            i = 1
            for point in self.coords[self.image_name]:
                bmdc.DrawCircle(self.scale*point[0], self.scale*point[1], 5)
                w,h = bmdc.GetTextExtent(str(i))
                bmdc.DrawText(str(i),self.scale*point[0]-w/2, self.scale*point[1]+5)
                i += 1

            del bmdc

            self.static_bitmap.SetBitmap(bm)


    # ------------- Event Handlers ---------------
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号