Browse Source

fix: rescaling INPUT area and MASKING

micha 4 days ago
parent
commit
c6d86dd4bb
1 changed files with 32 additions and 9 deletions
  1. 32 9
      vpu/vpu_live4.py

+ 32 - 9
vpu/vpu_live4.py

@@ -992,8 +992,8 @@ if options.mode:
 # PARSE COMMANDLINE ARGUMENTS
 CFG_IN    = {"name":"CFG_IN","x1":40,"y1":60,"x2":300,"y2":300 ,"w":300,"h":300}
 CFG_OUT   = {"name":"CFG_OUT","x1":40,"y1":60,"x2":300,"y2":300 ,"w":300,"h":300,"on":0}
-#CFG_OUT2   = {"name":"CFG_OUT2","x1":p*8+142,"y1":60,"x2":300,"y2":300 ,"w":300,"h":300,"on":0}
-CFG_OUT2   = {"name":"CFG_OUT2","x1":p*8+(16*2)+8,"y1":60,"x2":300,"y2":300 ,"w":300,"h":300,"on":0}
+#CFG_OUT2 = {"name":"CFG_OUT2","x1":p*8+142,"y1":60,"x2":300,"y2":300 ,"w":300,"h":300,"on":0}
+CFG_OUT2  = {"name":"CFG_OUT2","x1":p*8+(16*2)+8,"y1":60,"x2":300,"y2":300 ,"w":300,"h":300,"on":0}
 CFG_BLOCK = {"name":"CFG_BLOCK","size":16,"h-split":2,"v-split":2,"h-count":8,"v-count":8}
 
     
@@ -1368,16 +1368,20 @@ class POINTER():
 
         if 1:# lupe / looking-glass / lens
             __t = 60
+            f_x = CFG_IN["y2"]+5
             rgb=[255,0,0]
             pos=[400,400,160,160]
+            pos=[400,f_x,160,160]
+            #pos=[400,400,f_x,f_x]
             draw_box_frame(window,rgb,pos,offset=1)
             r_sub = grab(x=self._x-__t/2,y=self._y-__t/2,w=__t,h=__t)
             if r_sub:
                 r_sub = pygame.transform.scale(r_sub,(160,160))
                 if r_sub: # target
-                    window.blit(r_sub, (400,400))
+                    window.blit(r_sub, (400,f_x))
                     #pos=[400+40,400+40,80,80]
                     pos=[400+80,400+80,80,80]
+                    pos=[400+80,f_x+80,80,80]
                     draw_box_frame(window,rgb,pos,offset=3)
                     draw_box_frame(window,rgb,pos,offset=2)
                     draw_box_frame(window,rgb,pos,offset=0)
@@ -1401,20 +1405,23 @@ class POINTER():
             rgb = [200,200,200]
             if _x < 0:
                 rgb = [200,0,0]
-            fr = font80.render("X:{:03}".format(_x) ,1, rgb)
-            window.blit(fr,(200,400))
+            fr = font40.render("X:{:03}".format(_x) ,1, rgb)
+            f_x = CFG_IN["y2"]+8
+            window.blit(fr,(100,f_x))
             rgb = [200,200,200]
             if _y < 0:
                 rgb = [200,0,0]
-            fr = font80.render("Y:{:03}".format(_y) ,1, rgb)
-            window.blit(fr,(200,450))
+            fr = font40.render("Y:{:03}".format(_y) ,1, rgb)
+            window.blit(fr,(200,f_x))
         
         p=110
 
         # crosshair
         self.rgb = [0,0,200]
         pygame.draw.line(window,self.rgb, (self.x-p,self.y) , (self.x-2,self.y),2 ) 
-        pygame.draw.line(window,self.rgb, (self.x,self.y-p) , (self.x,self.y-2),2 ) 
+        #pygame.draw.line(window,self.rgb, (self.x,self.y-p) , (self.x,self.y-2),2 ) 
+        self.rgb = [0,100,200]
+        pygame.draw.line(window,self.rgb, (self.x,self.y-p/3) , (self.x,self.y-2),2 ) 
 
         self.rgb = [0,200,0]
         pygame.draw.line(window,self.rgb, (self.x+2,self.y) , (self.x+p,self.y),2 ) 
@@ -1538,12 +1545,16 @@ def input_mask(): # unten
     RGB = [0,0,50]
     #RGB = [120,0,110] # test
     start = 227
+    #f_x = CFG_IN["x2"]-50
+    f_x = CFG_IN["y2"]+3
+    
     # oben
     pygame.draw.rect(window,RGB,[0,start,MAIN_SIZE[0]+200,7]) # background
     # links 
     pygame.draw.rect(window,RGB,[0,start,35,200]) # background
     # unten
-    pygame.draw.rect(window,RGB,[0,start+173,MAIN_SIZE[0]+200,198]) # background
+    #pygame.draw.rect(window,RGB,[0,start+173,MAIN_SIZE[0]+200,198]) # background
+    pygame.draw.rect(window,RGB,[0,f_x,MAIN_SIZE[0]+200,198]) # background
 
 def draw_main_overlay():
     global fps,fps2
@@ -1585,6 +1596,16 @@ def draw_main_overlay():
     except Exception as e:
         print("Overlay err:",e)
 
+    rgb = [255,255,200]
+    global CFG
+
+    # kennlinie linker rand
+    f_x = CFG_IN["y1"]
+    pygame.draw.line(window,rgb,[0,f_x],[20,f_x]) 
+    f_x = CFG_IN["y2"]
+    pygame.draw.line(window,rgb,[0,f_x],[20,f_x]) 
+
+
 def draw_box_frame(window,rgb,pos,offset=0):
     p1 = [pos[0],pos[1]]
     p2 = [pos[0]+pos[2],pos[1]+pos[3]]
@@ -2805,6 +2826,8 @@ def img_open(img_meta):
     h_max = 320
     #w_max = 600
     #h_max = 400
+    w_max = 4800 # max input jpg resolution
+    h_max = 3200 # max input jpg resolution
     if width > w_max:
         h = int(height*(w_max/width))
         w = w_max