> For the complete documentation index, see [llms.txt](https://pcl.gitbook.io/tutorial/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pcl.gitbook.io/tutorial/part-1/part01-chapter01/part01-chapter01-open3d-python.md).

# Open3D-Python (70%)

> Jupyter 버젼은 [\[이곳\]](https://github.com/adioshun/gitBook_Tutorial_PCL/blob/master/Beginner/Part01-Chapter01-Open3D-Python.ipynb)에서 확인 가능 합니다.

## 1. 읽기

```python
import open3d
import numpy as np


#PCD 파일 읽기
pc = open3d.read_point_cloud("./sample/lobby.pcd") 
print(pc)

#txt 파일 읽기
open3d.read_point_cloud("./sample/open3d_xyz.txt", format='xyz')
```

## 2. 생성

```python
import open3d
import numpy as np

pc_array = np.array([[1, 2, 3], [3, 4, 5]], dtype=np.float32)
print(pc_array)

pc = open3d.PointCloud()
pc.points = open3d.Vector3dVector(pc_array)
print(pc)
```

## 3. 쓰기

지원 하는 확장자 : pcd, ply, xyz, xyzrgb, xyzn, pts

```python
import open3d

open3d.write_point_cloud("pc2pcd.pcd", pc)
```

## 4. 변환

```python
import open3d
import numpy as np

# Open3D to numpy
pcd_load = read_point_cloud("../../TestData/sync.pcd")
pc_array = np.asarray(pcd_load.points)
print("pc Type : {}".format(type(pc)))
print("pc_array Type : {}".format(type(pc_array)))

# numpy to Open3D
pc_new = open3d.PointCloud()
pc_new.points = open3d.Vector3dVector(pc_array)
open3d.write_point_cloud("pc2pcd.pcd", pc_new)
```

## 5. 정보 출력

```python
import open3d
import numpy as np

print("포인트 수 : {}".format(pc.dimension))


#print ('Loaded ' + str(pc.width * pc.height) + ' data points from test_pcd.pcd with the following fields: ')

for i in range(0, 10):
    print ('x: ' + str(pc.points[i][0]) + ', y : ' + str(pc.points[i][1]) + ', z : ' + str(pc.points[i][2]))
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pcl.gitbook.io/tutorial/part-1/part01-chapter01/part01-chapter01-open3d-python.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
