zed-sdk icon indicating copy to clipboard operation
zed-sdk copied to clipboard

how to convert cv2.Mat to sl.Mat in Python Code ?

Open XuErShuo opened this issue 2 years ago • 1 comments

Preliminary Checks

  • [X] This issue is not a duplicate. Before opening a new issue, please search existing issues.
  • [X] This issue is not a question, bug report, or anything other than a feature request directly related to this project.

Proposal

I want to convert python cv2 image to zed sl.Mat,please tell me how can i do, thanks

Use-Case

No response

Anything else?

No response

XuErShuo avatar Mar 05 '23 03:03 XuErShuo

Hi, You can share both memory between opencv mat and sl mat :

my_opencv_mat = my_sl_mat.get_data(sl.MEM.CPU, False)
//use opencv function on my_opencv_mat ex : cv2.rectange(my_opencv_mat,10,10,10,10...)

obraun-sl avatar Apr 13 '23 05:04 obraun-sl