Wiki

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Last revision Both sides next revision
resources:eval:user-guides:eval-adsd3175d-first-frame-pygame [10 May 2023 18:27]
Andre Straker-Payne created
resources:eval:user-guides:eval-adsd3175d-first-frame-pygame [10 May 2023 18:39]
Andre Straker-Payne Updated code and instructions
Line 1: Line 1:
 ====== Animated Depth Images using PyGame ====== ====== Animated Depth Images using PyGame ======
 +
 +The following examples works with the eval kit release TOF_Evaluation_ADTF3175D-Rel4.1.1 with Python 3.9.
 +
 +It is assumed depth-image-animation-pygame.py is in TOF_Evaluation_ADTF3175D-Rel4.1.1/​bin.
 +
 +Python dependencies are:
 +  * Matplotlib - used for the viridis color map
 +  * PyGame - used for the animate
 +  * NumPy
  
 == Usage == == Usage ==
Line 49: Line 58:
 import matplotlib.pyplot as plt import matplotlib.pyplot as plt
 from matplotlib.colors import ListedColormap from matplotlib.colors import ListedColormap
 +
 +modemapping = {
 +"​mp":​ {"​width":​1024,​ "​height":​1024},​
 +"​qmp":​ {"​width":​512,​ "​height":​512}
 +}
 +
 +mode = "​mp"​
  
 if len(sys.argv) < 2  or sys.argv[1] == "​--help"​ or sys.argv[1] == "​-h"​ : if len(sys.argv) < 2  or sys.argv[1] == "​--help"​ or sys.argv[1] == "​-h"​ :
Line 91: Line 107:
 print("​camera1 details:",​ "​id:",​ camDetails.cameraId,​ "​connection:",​ camDetails.connection) print("​camera1 details:",​ "​id:",​ camDetails.cameraId,​ "​connection:",​ camDetails.connection)
  
-status = camera1.setFrameType("​mp"​)+status = camera1.setFrameType(mode)
 print("​camera1.setFrameType()",​ status) print("​camera1.setFrameType()",​ status)
  
Line 117: Line 133:
 def main(): def main():
     pygame.init()     pygame.init()
-    window_size = (10241024)+    window_size = (modemapping[mode]["​width"​]modemapping[mode]["​height"​])
     screen = pygame.display.set_mode(window_size)     screen = pygame.display.set_mode(window_size)
  
resources/eval/user-guides/eval-adsd3175d-first-frame-pygame.txt · Last modified: 13 Jun 2023 22:18 by Andre Straker-Payne