Skip to main content

cumo

cumoは、Pythonから3D点群をブラウザ上で表示するためのライブラリです。

インストール

$ pip install cumo

ドキュメント

sphinxでドキュメントの生成が可能です。 devcontainer環境を使用することで、ビルド環境を構築することができます。 その中で以下のようにすると、lib/docs/以下にドキュメントが生成されます。

$ cd lib
$ poetry install
$ poetry run sphinx-apidoc --append-syspath -F -o ./docs .

使用例

lib/cumo/__main__.pyは3面図を撮る例です。 lib/以下に適当なPCDファイル(以下の例ではpcl_logo.pcd)を用意して、以下のようにするとpcdファイルを閲覧できます。

$ cd lib
$ poetry run python -m cumo pcl_logo.pcd
open: http://127.0.0.1:8082
setup...
resize window and press custom control button "start"
saved: screenshot_x.png
saved: screenshot_y.png
saved: screenshot_z.png

REPLでの使用も可能です。

$ poetry run python
Python 3.8.7 (default, Apr  9 2022, 21:34:33)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from cumo import PointCloudViewer
>>> viewer = PointCloudViewer()
>>> viewer.start()
>>> # open localhost:8082 on your browser
>>> with open(filename, "rb") as f:
>>>     b = f.read()
>>>     viewer.send_pointcloud_pcd(b)

cumo開発者向け

大まかな構成

cumoは以下のように、大まかに2つの要素からなります。

  • lib/ : Pythonライブラリ。PointCloudViewerクラスを提供する。クライアントのHTMLを配信し、クライアントとWebSocket通信を行う。
  • client/ : クライアントページ。ライブラリとWebSocket通信を行い、ライブラリからの操作を受け付ける。

これら2つの通信はWebSocketを使用しています。 通信データはProtocol Buffersにより定義されており、それぞれで使われている言語のライブラリが自動で生成されます。

  • protobuf/server.proto: ライブラリからクライアントへ送信されるデータ
  • protobuf/client.proto: クライアントからライブラリへ送信されるデータ

ビルド

devcontainerを使用することで、ビルド環境を構築することができます。 devcontainer環境に入り、下のようにするとlib/dist/以下にtar.gzとwhlファイルが生成されます。 クライアントのHTML等はライブラリに含まれ、tar.gzやwhlファイルの中に格納されます。

$ ./build.sh

テスト

以下のようにするとテスト用のモードでクライアントページを配信することができます。

$ cd client
$ yarn serve

上のようにしてクライアントを配信するサーバを起動した後、ブラウザでクライアントを開きます(大抵の場合自動で開かれます)。 クライアントを開いた後、ライブラリ側を起動するとクライアント側に接続されます。

$ cd lib
$ poetry run python -m cumo pcl_logo.pcd

Metadata

Release files for cumo 0.33.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cumo 0.33.6
File Size Uploaded
cumo-0.33.6.tar.gz 1.2 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for cumo 0.33.6
File Interpreter ABI Platform
cumo-0.33.6-py3-none-any.whl Python 3 none any Details

Total release size: 2.4 MB

Release files / cumo-0.33.6.tar.gz

Download URL cumo-0.33.6.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
1d09803f5ff5b14dc6f9b6866d712afe4139595adb07d23ecc372c585bc22766
BLAKE2b-256 checksum
How to use checksums
051dc871b4b0e16878a69d71275dc6ea2011ad14102477935eceed59d782bb77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.8.10 Linux/6.8.0-76060800daily20240311-generic

Release files / cumo-0.33.6-py3-none-any.whl

Download URL cumo-0.33.6-py3-none-any.whl
Size 1.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
61841d65f7ffb68a14379dff2ff40864dffaa8d472db6386d10834aa3baea664
BLAKE2b-256 checksum
How to use checksums
2f802f32f626336a1bf0f50a4eb9c619e8a32ac4a9391c63da39fb6288a1072f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.8.10 Linux/6.8.0-76060800daily20240311-generic

Release history Release notifications | RSS feed

0.34.1

2 release files

0.33.7

2 release files

This release

0.33.6 This release

2 release files

0.33.5

2 release files

0.33.4

2 release files

0.33.3

2 release files

0.33.2

2 release files

0.33.1

2 release files

0.33.0

2 release files

0.32.0

2 release files

0.31.0

2 release files

0.30.0

2 release files

0.28.1

2 release files

0.28.0

2 release files

0.27.1

2 release files

0.26.0

2 release files

0.25.0

2 release files

0.22.0

2 release files

0.20.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page