pointcloud-ai / DepthEyeSdk

22 stars 11 forks source link

Is it OK to use the Python binding #1

Open avishorp opened 6 years ago

avishorp commented 6 years ago

When I try to connect to the camera from Python (using the Python lib in third_party/voxelsdk_ubuntu_4.13/lib), I get the following output:

In [9]: d=sys.connect(d[0])
CRITICAL: Config file: DepthEyeH1CDKCameraH1ForSeeed.conf
INFO: VoxelProgrammerBase: length=2 slave address 0x4b 0 value=274f register address(dec)=0
INFO: VoxelProgrammerBase: length=2 slave address 0x4e 0 value=274f register address(dec)=0
INFO: VoxelProgrammerBase: length=2 slave address 0x4b 5 value=4807 register address(dec)=5
INFO: VoxelProgrammerBase: length=2 slave address 0x4e 5 value=4f1b register address(dec)=5
INFO: ParameterDMLParser: Found register map with name 'calculus' (vPG2P0)

WARNING: MainConfigurationFile: Failed to read configuration from hardware.
WARNING: MainConfigurationFile: Could not open file '1024718.bin'
INFO: VoxelProgrammerBase: length=3 slave address 0x58 f8 value=820000 register address(dec)=248
INFO: DepthCamera: Setting parameter 'unambiguous_range'
INFO: VoxelProgrammerBase: length=3 slave address 0x58 80 value=00 register address(dec)=128
INFO: VoxelProgrammerBase: length=3 slave address 0x58 82 value=30d4 register address(dec)=130
INFO: VoxelProgrammerBase: length=3 slave address 0x58 5c value=340000 register address(dec)=92
INFO: VoxelProgrammerBase: length=3 slave address 0x58 2 value=04 register address(dec)=2
INFO: VoxelProgrammerBase: length=3 slave address 0x58 c value=250000 register address(dec)=12
INFO: VoxelProgrammerBase: length=3 slave address 0x58 f value=49a register address(dec)=15
INFO: VoxelProgrammerBase: length=3 slave address 0x58 c value=250000 register address(dec)=12
INFO: VoxelProgrammerBase: length=3 slave address 0x58 2 value=00 register address(dec)=2
INFO: VoxelProgrammerBase: length=3 slave address 0x58 2 value=04 register address(dec)=2
INFO: VoxelProgrammerBase: length=3 slave address 0x58 f value=4aa register address(dec)=15
INFO: VoxelProgrammerBase: length=3 slave address 0x58 2 value=00 register address(dec)=2
INFO: VoxelProgrammerBase: length=3 slave address 0x58 fb value=1e008 register address(dec)=251
INFO: VoxelProgrammerBase: length=3 slave address 0x58 fb value=1e008 register address(dec)=251
INFO: VoxelProgrammerBase: length=3 slave address 0x58 a0 value=800004 register address(dec)=160
INFO: VoxelProgrammerBase: length=3 slave address 0x58 80 value=01 register address(dec)=128
INFO: DepthCamera: Setting parameter 'mix_volt'
INFO: VoxelProgrammerBase: length=1 slave address 0x60 23 value=09 register address(dec)=35
INFO: DepthCamera: Setting parameter 'mod_freq1'
INFO: VoxelProgrammerBase: length=3 slave address 0x58 2 value=04 register address(dec)=2
INFO: VoxelProgrammerBase: length=3 slave address 0x58 c value=240000 register address(dec)=12
INFO: VoxelProgrammerBase: length=3 slave address 0x58 f value=4aa register address(dec)=15
INFO: VoxelProgrammerBase: length=3 slave address 0x58 c value=240000 register address(dec)=12
INFO: VoxelProgrammerBase: length=3 slave address 0x58 2 value=00 register address(dec)=2
INFO: VoxelProgrammerBase: length=3 slave address 0x58 2 value=04 register address(dec)=2
INFO: VoxelProgrammerBase: length=3 slave address 0x58 f value=4aa register address(dec)=15
INFO: VoxelProgrammerBase: length=3 slave address 0x58 2 value=00 register address(dec)=2
INFO: DepthCamera: Setting parameter 'mod_cdriv_en'
INFO: VoxelProgrammerBase: length=3 slave address 0x58 3b value=00 register address(dec)=59
INFO: DepthCamera: Setting parameter 'mod_cdriv_curr'
INFO: VoxelProgrammerBase: length=3 slave address 0x58 3b value=f0000 register address(dec)=59
INFO: DepthCamera: Setting parameter 'sub_frame_cnt_max1'
INFO: VoxelProgrammerBase: length=3 slave address 0x58 83 value=24 register address(dec)=131
INFO: VoxelProgrammerBase: length=3 slave address 0x58 82 value=186a0 register address(dec)=130
INFO: VoxelProgrammerBase: length=3 slave address 0x58 5c value=340000 register address(dec)=92
INFO: DepthCamera: Setting parameter 'intg_time'
INFO: VoxelProgrammerBase: length=3 slave address 0x58 5c value=180000 register address(dec)=92
INFO: DepthCamera: Setting parameter 'shutter_en'
INFO: VoxelProgrammerBase: length=3 slave address 0x58 5b value=c00001 register address(dec)=91
INFO: DepthCamera: Setting parameter 'high_ambient_en'
INFO: VoxelProgrammerBase: length=3 slave address 0x58 5 value=200000 register address(dec)=5
INFO: DepthCamera: Setting parameter 'disable_illum_p'
INFO: VoxelProgrammerBase: length=3 slave address 0x58 3a value=00 register address(dec)=58
INFO: DepthCamera: Setting parameter 'disable_illum_n'
INFO: VoxelProgrammerBase: length=3 slave address 0x58 3a value=00 register address(dec)=58
INFO: DepthCamera: Setting parameter 'pvdd_voltage'
INFO: VoxelProgrammerBase: length=3 slave address 0x58 2b value=140000 register address(dec)=43
INFO: DepthCamera: Setting parameter 'pvdd_en'
INFO: VoxelProgrammerBase: length=3 slave address 0x58 2a value=20 register address(dec)=42
INFO: VoxelProgrammerBase: length=3 slave address 0x58 1f value=3b0000 register address(dec)=31
INFO: VoxelProgrammerBase: length=3 slave address 0x58 1f value=3b0000 register address(dec)=31
INFO: VoxelProgrammerBase: length=3 slave address 0x58 20 value=00 register address(dec)=32
INFO: VoxelProgrammerBase: length=3 slave address 0x58 21 value=40004f register address(dec)=33
INFO: VoxelProgrammerBase: length=3 slave address 0x58 d9 value=0c register address(dec)=217
INFO: VoxelProgrammerBase: length=3 slave address 0x58 d9 value=0c register address(dec)=217
INFO: VoxelProgrammerBase: length=3 slave address 0x58 d9 value=0c register address(dec)=217
INFO: VoxelProgrammerBase: length=3 slave address 0x58 d9 value=0c register address(dec)=217
INFO: VoxelProgrammerBase: length=3 slave address 0x58 d9 value=0c register address(dec)=217
INFO: VoxelProgrammerBase: length=3 slave address 0x58 d9 value=0c register address(dec)=217
INFO: VoxelProgrammerBase: length=3 slave address 0x58 8 value=04 register address(dec)=8
INFO: VoxelProgrammerBase: length=3 slave address 0x58 8 value=00 register address(dec)=8
INFO: VoxelProgrammerBase: length=3 slave address 0x58 12 value=0a register address(dec)=18
INFO: VoxelProgrammerBase: length=3 slave address 0x58 1b value=0a register address(dec)=27
INFO: VoxelProgrammerBase: length=3 slave address 0x58 b value=2000 register address(dec)=11
INFO: VoxelProgrammerBase: length=3 slave address 0x58 3a value=20 register address(dec)=58
INFO: VoxelProgrammerBase: length=3 slave address 0x58 3 value=00 register address(dec)=3
INFO: VoxelProgrammerBase: length=3 slave address 0x58 f7 value=20000 register address(dec)=247
INFO: VoxelProgrammerBase: length=3 slave address 0x58 fa value=27f9f9 register address(dec)=250
INFO: VoxelProgrammerBase: length=3 slave address 0x58 f9 value=84000 register address(dec)=249
INFO: VoxelProgrammerBase: length=3 slave address 0x58 f9 value=c4000 register address(dec)=249
INFO: VoxelProgrammerBase: length=3 slave address 0x58 81 value=a0 register address(dec)=129
INFO: VoxelProgrammerBase: length=3 slave address 0x58 5b value=c00001 register address(dec)=91
INFO: VoxelProgrammerBase: length=3 slave address 0x58 5c value=180000 register address(dec)=92
INFO: VoxelProgrammerBase: length=3 slave address 0x58 5c value=181000 register address(dec)=92
INFO: VoxelProgrammerBase: length=3 slave address 0x58 80 value=01 register address(dec)=128
INFO: CameraSystem: Successfully refreshed parameters for DepthEyeH1CDKCamera(0::0451:9107::1024718).

Apparently, it seem to have loaded the correct config file, but later it says that the register map is 'calculus'. Is it initializing my camera correctly?

pointcloud-ai commented 6 years ago

Here are the python sample code for your reference:

import Voxel
import numpy as np

def createWindow():
    global window
    if window == None:
        window = MainWindow(cameraSystem)
    return

class MainWindow():
    ascii_char = list("$@B%8&WM#*oahkbdpqwmZO0QLCJUYXzcvunxrjft/\|()1{}[]?-_+~<>i!lI;:,\"^`'. ")
    # self.width = 80
 #  self.height = 60
    def __init__(self, cameraSystem):
        print("MainWindow init")
        self.depthCamera = cameraSystem.connect(devices[0])
        if self.depthCamera:
            self.depthCamera.clearAllCallbacks()
            self.depthCamera.registerCallback(Voxel.DepthCamera.FRAME_DEPTH_FRAME, self.callbackInternal)
            self.depthCamera.registerCallback(Voxel.DepthCamera.FRAME_XYZI_POINT_CLOUD_FRAME, self.callbackInternal)
            if not self.depthCamera.start():
                print(" start fail")
            else:
                print(" start ok")

    def callbackInternal(self, depthCamera, frame, type):
        print("frame.id:  %s" %frame.id)   
        print("frame.id:  %s" %frame.timestamp)   

cameraSystem = Voxel.CameraSystem()

devices = cameraSystem.scan()
# depthCamera = None

if len(devices) == 1:
     print(" find one devices")  
     window = MainWindow(cameraSystem)
     key = raw_input("Input enter key to quit ")
     print(" quit now")
else:
   print(" no device found")

del cameraSystem
pointcloud-ai commented 6 years ago

DepthEye SDK can support Python binding

avishorp commented 6 years ago

Can you show in your example how do I access the actual data (amplitude, phase and ambient) within the callback?

‫בתאריך יום ג׳, 16 באוק׳ 2018 ב-5:55 מאת ‪pointcloud-ai‬‏ <‪ notifications@github.com‬‏>:‬

DepthEye SDK can support Python binding

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pointcloud-ai/DepthEyeSdk/issues/1#issuecomment-430083167, or mute the thread https://github.com/notifications/unsubscribe-auth/ABImMqH9-SL1SHEjhHYzzde7gDxeagCZks5ulUqTgaJpZM4XAsmo .