Mastering 3D Computer Vision & Point Cloud Processing- Mod 6–Different File Formats for Reading and Writing Point Cloud Data

Rajavel PM (RPM)
5 min readApr 4, 2024

--

Introduction:

Welcome to the ✍️“3D Computer Vision & Point Cloud Processing Blog Series”. This series of blogs is your 🚀 hands-on guide to mastering 3D point cloud processing with Python.

In this post, we’ll explore the different file formats for reading and writing 3D point cloud data, focusing on ASCII and Binary formats.

Topics to Be Discussed in this Blog

  1. Different Formats for Reading and writing the Point Cloud Data
  2. ASCII Format
  3. Binary Format
  4. Difference between ASCII and Binary 3D Point Cloud Data
  5. Summary

Before reading this blog, I recommend reading my previous blog on Different File Formats Used for 3D Data (How to Store a Point Cloud Data?)

Different Formats for Reading and writing the Point Cloud Data

While 3D point cloud data can be represented in various formats such as XYZ, PCD, PLY, LiDAR, and others to suit different applications and needs, these file formats can be read and written in two main representations: ASCII and Binary. Each representation has its own advantages and disadvantages, which we’ll discuss in detail.

I. ASCII Format:

  1. Definition: ASCII, short for American Standard Code for Information Interchange, is a character encoding standard used for representing text in computers and communication equipment. In the context of point cloud data, ASCII format involves storing data in plain text, where each point’s attributes (e.g., coordinates, colors, normals) are represented as human-readable text characters.
  2. Application: ASCII format finds widespread use for storing point cloud data, especially when human readability and modifiability are crucial. It is often preferred for small to moderately sized datasets, prototyping, or situations where the data may need manual editing.
  3. Computation: Reading and writing ASCII point cloud data require parsing text, making it computationally more intensive than binary formats. This format involves converting between text and numeric representations during I/O operations.
  4. Size: ASCII files tend to be larger compared to their binary counterparts due to each data point being represented as text characters, which consume more storage space.
  5. Complexity: ASCII files are simple and human-readable, easily viewed and edited using a text editor, making them accessible to a wide range of users.

6. When to Use:

  • Use ASCII when human readability and editability are essential.
  • Useful for small to moderately sized datasets.
  • Suitable for prototyping and experimentation.

7. When Not to Use:

  • Avoid ASCII for very large point cloud datasets due to impractical file sizes.
  • Not suitable for real-time applications because of slower I/O operations.

8. Advantages:

  • Human-readable and editable with a simple text editor.
  • No need for specialized tools to interpret or view the data
  • Suitable for small to medium-sized datasets and prototyping.

9. Disadvantages:

  • Larger file sizes compared to binary formats.
  • Slower I/O operations due to text parsing during reading and writing.
  • Impractical for very large datasets or real-time applications.

II. Binary Format:

  1. Definition: Binary format, also known as “Bin” format, encodes point cloud data in a binary form. This format stores point attributes in a more compact and machine-readable manner.
  2. Application: Binary formats are widely used for storing and exchanging point cloud data in scenarios where file size, storage efficiency, and rapid I/O operations are critical. They are particularly suitable for large datasets and real-time applications.
  3. Computation: Reading and writing binary point cloud data is computationally efficient. Data can be transferred directly to memory without the need for text parsing, leading to faster processing.
  4. Size: Binary files are more compact than their ASCII counterparts, resulting in smaller file sizes. This advantage is significant for managing massive point cloud datasets efficiently.
  5. Complexity: Binary files are not human-readable, requiring specialized software or tools for interpretation or modification.
  6. When to Use:
  • Use binary formats for managing large point cloud datasets.
  • Ideal for real-time applications where rapid I/O operations are crucial.
  • Suitable for scenarios prioritizing storage efficiency.

7. When Not to Use:

  • Avoid binary formats when human readability or editability is necessary.
  • Not suitable for scenarios requiring manual inspection or modification of data.

8. Advantages:

  • Smaller file sizes, making them practical for large datasets.
  • Faster I/O operations due to efficient binary encoding.
  • Suitable for real-time applications.

9. Disadvantages:

  • Not human-readable or editable without specialized tools.
  • Requires knowledge of the binary encoding format for direct interpretation.

Difference between ASCII and Binary 3D Point Cloud Data:

Below is a table highlighting the key differences between ASCII and Binary formats for point cloud data.

Below is the Bunny point cloud data as seen in both ASCII and Binary formats when viewed in Notepad++.

1. Bunny Point cloud data seen from a single view point

Sample Bunny Mesh data

2. Bunny point cloud data in ASCII Format as seen in Notepad++

ply
format ascii 1.0
element vertex 35947
property double x
property double y
property double z
property double nx
property double ny
property double nz
element face 71600
property list uchar uint vertex_indices
end_header
-0.0378297 0.12794 0.00447467 0.223443 0.969626 -0.0994941
-0.0447794 0.128887 0.00190497 0.302825 0.918277 -0.255076
-0.0680095 0.151244 0.0371953 0.0930339 0.776336 0.623416
-0.00228741 0.13015 0.0232201 -0.0645244 0.968816 0.239232

3. Bunny point cloud data in Binary Format as seen in Notepad++

ply
format binary_little_endian 1.0
element vertex 35947
property double x
property double y
property double z
property double nx
property double ny
property double nz
element face 71600
property list uchar uint vertex_indices
end_header
5Ž¢j^£¿ªÔìV`À?ð]÷Tr?Ž"¼ǙÌ?Ñ=ë-ï?®¥rx¹¿LªUSí¦¿)•ð„^À?ådö6_?QÚ|aÓ?bhur†bí?Ó¥I*Sп\;Qi±¿:­Û ö[Ã?º;!*C £?€YëÕÑ·?{£V˜¾×è?J³yóã?·ä ½b¿ð…ÉTÁ¨À?j|pˆÇ-?
EËË«„°¿ÝíziŠ ï?Ô
x'ŸÎ?AÚ¶Þ%-¿-Cëâ6À?¶§ý9yO}?M2rö´Ï¿0[wóÔî?,¸ðÀ º¿<ïÛµ™¿B-pè-À?ÁÙè{'y?.È–åë2È¿UÀ=ÏŸ6ï?/m8,
ü¼¿.ÿ¶‚£¿36t³?PÀ?ÚiµÑJk]?Üóüi£:Ñ?,H3Mgî?&üR?o*Ä¿ ¦šYK¡??U…bÙ¼?"7¸¾Yœ?7߈îYWç?"É©ajà?j1x˜öÜ?CV·zNz£?

Summary

This blog post has explored the various aspects of 3D point cloud data file formats, focusing on ASCII and Binary formats. It has discussed their definitions, applications, computational aspects, sizes, complexities, and use cases. Additionally, the post has highlighted the differences between ASCII and Binary formats and provided examples of point cloud data in both formats. The post also included examples of point cloud data in both ASCII and Binary formats, showcasing their differences and how they appear in text editors like Notepad++.

Happy exploring! Happy learning!

📝Next Blog Preview:

In the upcoming post, 🚀“Mastering 3D Computer Vision & Point Cloud Processing- Mod 7–Setting Up Python Libraries and Environment for Point Cloud Processing”.

Topics to Be Discussed in the Next Blog

  1. Create virtual environment and install packages
  2. Install Packages and libraries
  3. Know your libraries

Topics to Be Discussed in the Upcoming Blogs — Immediate Focus

  • Libraries for Visualizing Point Clouds
  • Mostly used Tools and libraries for Point Cloud Visualization by developers
  • Sample Point cloud visualization using Matplotlib and Open3D
  • Explore 3D Metadata

--

--

Rajavel PM (RPM)
Rajavel PM (RPM)

Written by Rajavel PM (RPM)

Computer Vision Engineer. Working on 3D computer vision, 3D machine learning & 3D Deep Learning, AI, and Generative AI. Let's learn together. Join Me!

No responses yet