Skip to content

Segmentation Fault with Mat.get_data(memory_type=sl.MEM.MEM_GPU) #120

@ajwillia

Description

@ajwillia

I'm running on a Jetson TX2 development board with latest JetPack and latest ZED SDK. ZED camera is latest firmware.
python3 --version
Python 3.6.9

When I make a call to Mat.get_data(memory_type=sl.MEM.MEM_GPU) I get a Segmentation Fault.

Code to repro:

import pyzed.sl as sl

if __name__ == '__main__':
    zed = sl.Camera()
    
    init_params = sl.InitParameters()
    init_params.camera_resolution = sl.RESOLUTION.RESOLUTION_VGA
    init_params.depth_mode = sl.DEPTH_MODE.DEPTH_MODE_PERFORMANCE

    # Open the camera
    status = zed.open(init_params)
    if status != sl.ERROR_CODE.SUCCESS:
        print(repr(status))
        exit()	    

    resolution = zed.get_resolution()
    # create matrices for camera image and depth info in GPU memory
    image = sl.Mat(resolution.width, 
                    resolution.height,
                    sl.MAT_TYPE.MAT_TYPE_8U_C4,
                    memory_type=sl.MEM.MEM_GPU)

    depth = sl.Mat(resolution.width, 
                        resolution.height,
                        sl.MAT_TYPE.MAT_TYPE_32F_C1,
                        memory_type=sl.MEM.MEM_GPU) 

    if zed.grab(runtime_parameters) == sl.ERROR_CODE.SUCCESS:     
        zed.retrieve_image(image, sl.VIEW.VIEW_LEFT,
                        type=sl.MEM.MEM_GPU)
        # Retrieve depth map. Depth is aligned on the left image
        zed.retrieve_measure(depth, sl.MEASURE.MEASURE_DEPTH,
                                type=sl.MEM.MEM_GPU)	
        
        
        #SegFault!
        d = image.get_data(memory_type=sl.MEM.MEM_GPU)                        

Am I doing something wrong? If not, is there a work-around? I plan on using opencv cuda functions for image processing which is why I need the call to get_data in GPU memory

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions