{"id":13443970,"url":"https://github.com/dimatura/pypcd","last_synced_at":"2025-05-16T10:05:59.133Z","repository":{"id":7685168,"uuid":"9048457","full_name":"dimatura/pypcd","owner":"dimatura","description":"PCL pcd fileformat i/o in Python","archived":false,"fork":false,"pushed_at":"2024-07-26T05:52:51.000Z","size":1478,"stargazers_count":287,"open_issues_count":24,"forks_count":200,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-16T10:05:14.932Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dimatura.png","metadata":{"files":{"readme":"README.rst","changelog":"HISTORY.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-03-27T07:03:59.000Z","updated_at":"2025-05-06T02:11:26.000Z","dependencies_parsed_at":"2024-10-28T05:53:57.040Z","dependency_job_id":"f47e7097-5400-467b-9ad5-0f6ba119baee","html_url":"https://github.com/dimatura/pypcd","commit_stats":{"total_commits":44,"total_committers":3,"mean_commits":"14.666666666666666","dds":0.25,"last_synced_commit":"20b032bfc729dec853ac810bceeb360f78bdc1d6"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimatura%2Fpypcd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimatura%2Fpypcd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimatura%2Fpypcd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimatura%2Fpypcd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dimatura","download_url":"https://codeload.github.com/dimatura/pypcd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254509477,"owners_count":22082891,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T03:02:15.373Z","updated_at":"2025-05-16T10:05:59.095Z","avatar_url":"https://github.com/dimatura.png","language":"Python","funding_links":[],"categories":["Python","Libraries"],"sub_categories":[],"readme":"``pypcd``\n=========\n\nWhat?\n-----\n\nPure Python module to read and write point clouds stored in the\n`PCD file format \u003chttp://pointclouds.org/documentation/tutorials/pcd_file_format.php\u003e`__,\nused by the `Point Cloud Library \u003chttp://pointclouds.org/\u003e`__.\n\nWhy?\n----\n\nYou want to mess around with your point cloud data without writing C++\nand waiting hours for the template-heavy PCL code to compile.\n\nYou tried to get some of the Python bindings for PCL to compile\nand just gave up.\n\nHow does it work?\n-----------------\n\nIt parses the PCD header and loads the data (whether in ``ascii``,\n``binary`` or ``binary_compressed`` format) as a\n`Numpy \u003chttp://www.numpy.org\u003e`__ structured array. It creates an\ninstance of the ``PointCloud``\nclass, containing the point cloud data as ``pc_data``, and\nsome convenience functions for I/O and metadata access.\nSee the comments in ``pypcd.py`` for some info on the point cloud\nstructure.\n\nExample\n-------\n\n.. code:: python\n\n    import pypcd\n    # also can read from file handles.\n    pc = pypcd.PointCloud.from_path('foo.pcd')\n    # pc.pc_data has the data as a structured array\n    # pc.fields, pc.count, etc have the metadata\n\n    # center the x field\n    pc.pc_data['x'] -= pc.pc_data['x'].mean()\n\n    # save as binary compressed\n    pc.save_pcd('bar.pcd', compression='binary_compressed')\n\n\nHow to install\n--------------\n\n.. code:: bash\n\n    pip install pypcd\n\nThat's it! You may want to install optional dependencies such as `pandas\n\u003chttps://pandas.pydata.org\u003e`__.\n\nYou can also clone this repo and use setup.py. \n\n.. code:: bash\n\n    git clone https://github.com/dimatura/pypcd\n\nNote that downloading data assets will\nrequire `git-lfs \u003chttps://git-lfs.github.com\u003e`__.\n\n\nUsing with ROS\n---------------\n\nYou can also use this library with ROS ``sensor_msgs``, but it is *not* a dependency.\nYou don't need to install this package with catkin -- using `pip` should be fine --\nbut if you want to it is possible:\n\nSteps:\n\n.. code:: bash\n\n    # you need to do this manually in this case\n    pip install python-lzf\n    cd your_workspace/src\n    git clone https://github.com/dimatura/pypcd\n    mv setup_ros.py setup.py\n    catkin build pypcd\n    source ../devel/setup.bash\n\n\nThen you can do something like this:\n\n.. code:: python\n\n    import pypcd\n    import rospy\n    from sensor_msgs.msg import PointCloud2\n\n\n    def cb(msg):\n        pc = PointCloud.from_msg(msg)\n        pc.save('foo.pcd', compression='binary_compressed')\n        # maybe manipulate your pointcloud\n        pc.pc_data['x'] *= -1\n        outmsg = pc.to_msg()\n        # you'll probably need to set the header\n        outmsg.header = msg.header\n        pub.publish(outmsg)\n\n    # ...\n    sub = rospy.Subscriber('incloud', PointCloud2)\n    pub = rospy.Publisher('outcloud', PointCloud2, cb)\n    rospy.init('pypcd_node')\n    rospy.spin()\n\n\n\nIs it beautiful, production-ready code?\n---------------------------------------\n\nNo.\n\nWhat else can it do?\n--------------------\n\nThere's a bunch of functionality accumulated\nover time, much of it hackish and untested.\nIn no particular order,\n\n-  Supports ``ascii``, ``binary`` and ``binary_compressed`` data.\n   The latter requires the ``lzf`` module.\n-  Decode and encode RGB into a single ``float32`` number. If\n   you don't know what I'm talking about consider yourself lucky.\n-  Point clouds to `pandas \u003chttps://pandas.pydata.org\u003e`__ dataframes. \n   This in particular is quite useful,\n   since `pandas` is pretty powerful and makes various operations\n   such as merging point clouds or manipulating values easy.\n   Conceptually, data frames are a good match to the point cloud format, since\n   many point clouds in reality have heterogeneous data types - e.g.\n   `x`, `y` and `z` are float fields but `label` is an int.\n-  Convert to and from `ROS \u003chttp://www.ros.org\u003e`__ PointCloud2\n   messages.\n   Requires the ROS ``sensor_msgs`` package with Python bindings\n   installed.\n   This functionality uses code developed by Jon Binney under\n   the BSD license, included as ``numpy_pc2.py``.\n\nWhat can't it do?\n-----------------\n\nThere's no synchronization between the metadata fields in\n``PointCloud``\nand the data in ``pc_data``. If you change the shape of ``pc_data``\nwithout updating the metadata fields you'll run into trouble.\n\nI've only used it for unorganized point cloud data\n(in PCD conventions, ``height=1``), not organized\ndata like what you get from RGBD.\nHowever, some things may still work.\n\nWhile padding and fields with count larger\nthan 1 seem to work, this is a somewhat\nad-hoc aspect of the PCD format, so be careful.\nIf you want to be safe, you're probably better off\nusing neither -- just name each component\nof your field something like ``FIELD_00``, ``FIELD_01``, etc.\n\nIt also can't run on Python 3, yet, but there's a PR to fix this\nthat might get pulled in the near future.\n\nIt's slow!\n----------\n\nTry using ``binary`` or ``binary_compressed``; using\nASCII is slow and takes up a lot of space, not to\nmention possibly inaccurate if you're not careful\nwith how you format your floats.\n\nI found a bug / I added a feature / I made your code cleaner\n------------------------------------------------------------\n\nThanks! You can submit a pull request. But honestly, I'm not too good\nat keeping up with my github :(\n\n\nTODO\n----\n\n- Better API for various operations.\n- Clean up, get rid of cruft.\n- Add a cli for common use cases like file type conversion.\n- Better support for structured point clouds, with tests.\n- Better testing.\n- Better docs. More examples.\n- More testing of padding\n- Improve handling of multicount fields\n- Better support for rgb nonsense\n- Export to ply?\n- Figure out if it's acceptable to use \"pointcloud\" as a single word.\n- Package data assets in pypi?\n\n\nCredits\n-------\n\nThe code for compressed point cloud data was informed by looking at\n`Matlab\nPCL \u003chttps://www.mathworks.com/matlabcentral/fileexchange/40382-matlab-to-point-cloud-library?requestedDomain=true\u003e`__.\n\n@wkentaro for some minor changes.\n\nI used `cookiecutter \u003chttps://github.com/audreyr/cookiecutter\u003e`__ to\nhelp with the packaging.\n\nThe code in ``numpy_pc2.py`` was developed by Jon Binney under\nthe BSD license for `ROS \u003chttp://www.ros.org\u003e`__.\n\nI want to congratulate you / insult you\n---------------------------------------\n\nMy email is ``dimatura@cmu.edu``.\n\nCopyright (C) 2015-2017 Daniel Maturana\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimatura%2Fpypcd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdimatura%2Fpypcd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimatura%2Fpypcd/lists"}