|
|
@@ -515,13 +515,14 @@ class Vopen():
|
|
|
def rescale_frame2(self,frame, width):
|
|
|
height = int(frame.shape[0]/frame.shape[1] * width )
|
|
|
dim = (width, height)
|
|
|
- return self.cv2.resize(frame, dim, interpolation =cv2.INTER_AREA)
|
|
|
+ #return self.cv2.resize(frame, dim, interpolation =cv2.INTER_AREA)
|
|
|
+ return self.cv2.resize(frame, dim, interpolation =cv2.INTER_LINEAR)
|
|
|
|
|
|
def rescale_frame(self,frame, percent=75):
|
|
|
width = int(frame.shape[1] * percent/ 100)
|
|
|
height = int(frame.shape[0] * percent/ 100)
|
|
|
dim = (width, height)
|
|
|
- return self.cv2.resize(frame, dim, interpolation =cv2.INTER_AREA)
|
|
|
+ return self.cv2.resize(frame, dim, interpolation =cv2.INTER_LINEAR)
|
|
|
|
|
|
def pause(self):
|
|
|
#print("pause",self.t_last)
|
|
|
@@ -680,15 +681,23 @@ class Vopen():
|
|
|
rgb = [ 100,255,100]
|
|
|
else:
|
|
|
rgb = [255,100,0]
|
|
|
- pygame.draw.rect(wn,rgb,[220,MAIN_SIZE[1]-(self._id+1)*35,80,13])
|
|
|
+ pygame.draw.rect(wn,rgb,[220,MAIN_SIZE[1]-(self._id+1)*35,260,13])
|
|
|
+ #self.scale = 50 #%
|
|
|
+ #self.angle = 0 #%
|
|
|
+ #self.dmx=dmx
|
|
|
+ #if self._id >= 250:
|
|
|
+ # self.fname = "cam_"
|
|
|
+ #self.dim = 0
|
|
|
+ #self.x = 0
|
|
|
+ #self.y = 0
|
|
|
|
|
|
_line = "error no _line"
|
|
|
- _line ="FPS:{} F:{:05} von {:05} sec:{:0.02f} von {:0.02f}"
|
|
|
+ _line ="FPS:{} F:{:05} von {:05} sec:{:0.02f} von {:0.02f} POS:{:#}:{:#} z:{:#} d:{:#}"
|
|
|
if self.fps == 0: # check if div zerro
|
|
|
- _line = _line.format(self.fps,int(self.pos),len(self.buffer),(-1),pz )
|
|
|
+ _line = _line.format(self.fps,int(self.pos),len(self.buffer),(-1),pz ,self.x,self.y,self.scale,self.dim)
|
|
|
else:
|
|
|
pz = (len(self.buffer)/self.fps)
|
|
|
- _line = _line.format(self.fps,int(self.pos),len(self.buffer),(self.pos/self.fps),pz )
|
|
|
+ _line = _line.format(self.fps,int(self.pos),len(self.buffer),(self.pos/self.fps),pz ,self.x,self.y,self.scale,self.dim)
|
|
|
|
|
|
fr = font15.render(_line ,1, (0,0,0))
|
|
|
wn.blit(fr,(10,MAIN_SIZE[1]-(self._id+1)*35))
|
|
|
@@ -2477,9 +2486,11 @@ dmx_raw()
|
|
|
|
|
|
thread.start_new_thread(dmx_loop,())
|
|
|
|
|
|
-def draw_output_label(CFG,value,name="GRID_XX"):
|
|
|
+def draw_output_label(CFG,value,dmx="0.0",name="GRID_XX"):
|
|
|
dim_raw = value
|
|
|
|
|
|
+ pygame.draw.rect(window,[5,5,155],[CFG["x1"]-5,CFG["y2"]+4,130,35]) # background
|
|
|
+
|
|
|
# GRID_A1_DIM_LABEL
|
|
|
fr = font15.render("Output:"+name,1, (255,255,255))
|
|
|
fr_r = fr.get_rect(center=(int(wx/2),int(0+pm_wy-p*0-10)))
|
|
|
@@ -2487,6 +2498,9 @@ def draw_output_label(CFG,value,name="GRID_XX"):
|
|
|
|
|
|
fr = font15.render("inv-dim: "+str(dim_raw) ,1, (255,255,255))
|
|
|
fr_r = fr.get_rect(center=(int(wx/2),int(0+pm_wy-p*0-10)))
|
|
|
+ window.blit(fr,(CFG["x1"]+60,CFG["y2"]+15))
|
|
|
+
|
|
|
+ fr = font15.render("dmx: 1."+str(dmx) ,1, (255,255,255))
|
|
|
window.blit(fr,(CFG["x1"],CFG["y2"]+15))
|
|
|
|
|
|
def GRID_DIM(dim,x,y):
|
|
|
@@ -2513,7 +2527,8 @@ def GRID_A1_DIM():
|
|
|
dim=grid_dim_v
|
|
|
#dim=120
|
|
|
GRID_DIM(dim,x=CFG["x1"],y=CFG["y2"]-p*8)
|
|
|
- draw_output_label(CFG,dim,name="GRID_A1_DIM")
|
|
|
+ a=options.grid_a1_idim
|
|
|
+ draw_output_label(CFG,dim,a,name="GRID_A1_DIM")
|
|
|
|
|
|
def GRID_A2_DIM():
|
|
|
# GRID_A2 DIM
|
|
|
@@ -2534,8 +2549,39 @@ def GRID_A2_DIM():
|
|
|
s.set_alpha(dim) # alpha level
|
|
|
s.fill((0,0,0)) # this fills the entire surface
|
|
|
window.blit(s, (CFG["x1"],CFG["y2"]-p*8))
|
|
|
+ a=options.grid_a2_idim
|
|
|
+ draw_output_label(CFG,dim_raw,a,name="GRID_A2_DIM")
|
|
|
+
|
|
|
+def cvImageToSurface(cvImage):
|
|
|
+ if cvImage.dtype.name == 'uint16':
|
|
|
+ cvImage = (cvImage / 256).astype('uint8')
|
|
|
+ size = cvImage.shape[1::-1]
|
|
|
+ if len(cvImage.shape) == 2:
|
|
|
+ cvImage = np.repeat(cvImage.reshape(size[1], size[0], 1), 3, axis = 2)
|
|
|
+ format = 'RGB'
|
|
|
+ else:
|
|
|
+ format = 'RGBA' if cvImage.shape[2] == 4 else 'RGB'
|
|
|
+ cvImage[:, :, [0, 2]] = cvImage[:, :, [2, 0]]
|
|
|
+ surface = pygame.image.frombuffer(cvImage.flatten(), size, format)
|
|
|
+ return surface.convert_alpha() if format == 'RGBA' else surface.convert()
|
|
|
+
|
|
|
|
|
|
- draw_output_label(CFG,dim_raw,name="GRID_A2_DIM")
|
|
|
+def _img_open():
|
|
|
+ # x
|
|
|
+ # y
|
|
|
+ # dim
|
|
|
+ # scale
|
|
|
+ fname = '/opt/LibreLight/Xdesk/icon/picker.png'
|
|
|
+ image = cv2.imread(fname)
|
|
|
+ im2 = cvImageToSurface(image)
|
|
|
+ return im2
|
|
|
+
|
|
|
+def img_draw(im2):
|
|
|
+ r1=random.randint(0,3)
|
|
|
+ r2=random.randint(0,3)
|
|
|
+ window.blit(im2, (50+r1, 430+r2))
|
|
|
+
|
|
|
+png_im2 = _img_open()
|
|
|
|
|
|
t1 = Timer(143)
|
|
|
time.sleep(0.33)
|
|
|
@@ -2641,6 +2687,8 @@ def main():
|
|
|
draw_overlay()
|
|
|
pointer.draw(0,pm_wy) #wy
|
|
|
|
|
|
+ img_draw(png_im2)
|
|
|
+
|
|
|
|
|
|
pygame.display.flip()
|
|
|
clock.tick(25)
|