<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://boofcv.org/index.php?action=history&amp;feed=atom&amp;title=Example_Load_and_Save_Point_Clouds</id>
	<title>Example Load and Save Point Clouds - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://boofcv.org/index.php?action=history&amp;feed=atom&amp;title=Example_Load_and_Save_Point_Clouds"/>
	<link rel="alternate" type="text/html" href="https://boofcv.org/index.php?title=Example_Load_and_Save_Point_Clouds&amp;action=history"/>
	<updated>2026-05-08T05:53:29Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.36.2</generator>
	<entry>
		<id>https://boofcv.org/index.php?title=Example_Load_and_Save_Point_Clouds&amp;diff=2978&amp;oldid=prev</id>
		<title>Peter: Created page with &quot;Loading and saving a point cloud.  &#039;&#039;&#039;Example Code:&#039;&#039;&#039; * [https://github.com/lessthanoptimal/BoofCV/blob/v0.38/examples/src/main/java/boofcv/examples/pointclouds/ExampleLoadAn...&quot;</title>
		<link rel="alternate" type="text/html" href="https://boofcv.org/index.php?title=Example_Load_and_Save_Point_Clouds&amp;diff=2978&amp;oldid=prev"/>
		<updated>2021-07-12T22:09:00Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Loading and saving a point cloud.  &amp;#039;&amp;#039;&amp;#039;Example Code:&amp;#039;&amp;#039;&amp;#039; * [https://github.com/lessthanoptimal/BoofCV/blob/v0.38/examples/src/main/java/boofcv/examples/pointclouds/ExampleLoadAn...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Loading and saving a point cloud.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Example Code:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* [https://github.com/lessthanoptimal/BoofCV/blob/v0.38/examples/src/main/java/boofcv/examples/pointclouds/ExampleLoadAndSavePointCloud.java ExampleLoadAndSavePointCloud.java]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Concepts:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* 3D Point Cloud&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Related Examples:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* [[Example_View_Point_Cloud| Viewing a Point Cloud]]&lt;br /&gt;
&lt;br /&gt;
= Example Code =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Example showing how to load and save a point cloud.&lt;br /&gt;
 *&lt;br /&gt;
 * @author Peter Abeles&lt;br /&gt;
 */&lt;br /&gt;
public class ExampleLoadAndSavePointCloud {&lt;br /&gt;
	public static void main( String[] args ) throws IOException {&lt;br /&gt;
		File file = File.createTempFile(&amp;quot;boofcv&amp;quot;, &amp;quot;txt&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
		// Creating a point cloud and storing it in a more &amp;quot;exotic&amp;quot; format used when dealing with a very large&lt;br /&gt;
		// number of points.&lt;br /&gt;
		PackedArray&amp;lt;Point3D_F64&amp;gt; original = new PackedBigArrayPoint3D_F64();&lt;br /&gt;
		for (int i = 0; i &amp;lt; 100; i++) {&lt;br /&gt;
			// create arbitrary points&lt;br /&gt;
			original.append(new Point3D_F64(i, i + 1, -i));&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		System.out.println(&amp;quot;original.size=&amp;quot; + original.size());&lt;br /&gt;
&lt;br /&gt;
		// Save the colorless point cloud&lt;br /&gt;
		PointCloudIO.save3D(PointCloudIO.Format.PLY,&lt;br /&gt;
				PointCloudReader.wrap(&lt;br /&gt;
						// passed in (x,y,z) and rgb info&lt;br /&gt;
						( index, point ) -&amp;gt; point.setTo(original.getTemp(index)),&lt;br /&gt;
						// specifies the number of points&lt;br /&gt;
						original.size()),&lt;br /&gt;
				/* saveRGB */false, new FileOutputStream(file));&lt;br /&gt;
&lt;br /&gt;
		// create another arbitrary format to store the loaded results&lt;br /&gt;
		List&amp;lt;Point3D_F64&amp;gt; found = new ArrayList&amp;lt;&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
		PointCloudIO.load(PointCloudIO.Format.PLY, new FileInputStream(file),&lt;br /&gt;
				( x, y, z, rgb ) -&amp;gt; found.add(new Point3D_F64(x, y, z)));&lt;br /&gt;
		// There&amp;#039;s a non functional version of load() which will provide the writer with information about the&lt;br /&gt;
		// clouds size and format.&lt;br /&gt;
&lt;br /&gt;
		System.out.println(&amp;quot;found.size=&amp;quot; + found.size());&lt;br /&gt;
&lt;br /&gt;
		// clean up&lt;br /&gt;
		file.delete();&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Peter</name></author>
	</entry>
</feed>