# RealSense Python API: Construct BufData or frame

I need to call rs2_project_color_pixel_to_depth_pixel from Python with synthetic data. The data are generated in Python and do not come directly from the RealSense.

The first argument is the depth map of type BufData. How do I construct a BufData object in Python from a bytestream or an array? BufData does not seem to have a Python constructor, and I have not seen a way to get it from another type. BufData does support the buffer protocol, though it still might need a constructor. Another way would be to construct a frame, which has a method to provide BufData.

The binding to rs2_project_color_pixel_to_depth_pixel is defined on line 69 of pyrsutil.cpp.

BufData is defined on line 197 of python.hpp and the binding apparently on line 8 of pyrs_frame.cpp.