Beispiel #1
0
	def __init__(self):
		EMImage2DWidget.__init__(self)
		# the single image display widget
		self.datatodisp=[test_image(1),test_image(2)]

		self.curdata=0
		self.set_data(self.datatodisp[0])
	
		timer = QtCore.QTimer(self)
		timer.timeout.connect(self.mytimeout)
		timer.start(1000)
Beispiel #2
0
    def __init__(self, img, app):
        EMImage2DWidget.__init__(self, img, application=app)

        self.sx = img["nx"]
        self.sy = img["ny"]
        self.set_scale(.3)

        minxy = min(self.sx, self.sy)
        self.bar_len = minxy * .1
        self.bar_ypos = -self.sy * .2
        self.bar_thick = 20
        self.bar_xpos = self.sx / 2
        self.bar = EMShape()
        self.barspeed = 0.02 * minxy

        self.score = 0
        self.score_label = EMShape()

        self.ball = EMShape()
        self.ball_rad = 20
        self.ball_pos = np.array(
            [self.bar_xpos, self.bar_ypos + self.bar_thick + self.ball_rad])
        self.ball_speed = minxy * .01
        self.set_shapes({0: self.bar, 1: self.ball, 2: self.score_label})

        self.game_started = False

        self.data.mult(-1)
        #self.data.process_inplace("filter.lowpass.gauss",{"cutoff_abs":.05})
        #self.data.process_inplace("normalize")
        #self.data.process_inplace("threshold.belowtozero",{"minval":1})
        #print self.data["mean_nonzero"],self.sx,self.sy
        self.data.div(self.data["mean_nonzero"] * self.sx * self.sy)
        self.data.mult(1000)
        self.auto_contrast()
        self.data_grad = self.data.process("math.gradient.direction")
        self.del_msk = self.data.copy()
        self.del_msk.to_one()

        self.update_bar()
        self.update_score()
        self.update_ball()
        print("break bricks..")