Wouldn't it make sense to create these image for other point clouds than PointXYZ? I would propose to use a template here. Also, the typical type in PCL is a PointCloud, not a std::vector ;).