Documentation
¶
Overview ¶
Package pointcloud provides types and decoding for JPEG Pleno Point Cloud.
Package pointcloud provides decoding support for JPEG Pleno Point Cloud coding (ISO/IEC 21794-6).
Point cloud coding represents 3D geometry as a set of discrete points in Cartesian (x, y, z) space. Each point may optionally have color (RGB) and normal vector attributes.
Compression Modes ¶
JPEG Pleno Point Cloud supports learning-based compression approaches that use neural networks for geometry and attribute coding. The standard defines the bitstream format but allows flexibility in decoder implementation.
Coordinate System ¶
Points use a 3D Cartesian coordinate system (x, y, z). The origin and scale depend on the source data and are specified in the metadata.
Attributes ¶
Each point may have optional attributes:
- Color: RGB values (0-255)
- Normal: Unit normal vector (nx, ny, nz)
Security ¶
All operations enforce security limits:
- MaxPointCloudPoints: Maximum total point count (100 million)
Package pointcloud provides types and decoding for JPEG Pleno Point Cloud.
Index ¶
- func ComputeCentroid(pc *PointCloud) (*jpegpleno.Point3DCoord, error)
- func GetBoundingBox(pc *PointCloud) (*jpegpleno.BoundingBox3D, error)
- type AttributeStream
- type AttributeType
- type CompressionMode
- type Decoder
- type GeometryStream
- type GeometryType
- type OctreeNode
- type Point
- type PointCloud
- type PointCloudHeader
- type PointCloudInfo
- type PointCloudSlice
- type ReconstructionParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeCentroid ¶
func ComputeCentroid(pc *PointCloud) (*jpegpleno.Point3DCoord, error)
ComputeCentroid computes the centroid of the point cloud.
func GetBoundingBox ¶
func GetBoundingBox(pc *PointCloud) (*jpegpleno.BoundingBox3D, error)
GetBoundingBox returns the bounding box of the point cloud.
Types ¶
type AttributeStream ¶
type AttributeStream struct {
// Data contains the compressed attribute data.
Data []byte
// PointCount is the number of points with attributes.
PointCount int64
// AttributeType is the type of attributes in this stream.
AttributeType AttributeType
// Offset is the byte offset in the file.
Offset int64
}
AttributeStream represents the compressed attribute data stream.
func (*AttributeStream) Validate ¶
func (a *AttributeStream) Validate() error
Validate checks that the attribute stream is valid.
type AttributeType ¶
type AttributeType uint8
AttributeType defines the type of point attribute.
const ( // AttributeTypeNone indicates no attributes. AttributeTypeNone AttributeType = 0 // AttributeTypeRGB indicates RGB color (3 bytes per point). AttributeTypeRGB AttributeType = 1 // AttributeTypeRGBA indicates RGBA color (4 bytes per point). AttributeTypeRGBA AttributeType = 2 // AttributeTypeNormal indicates normal vectors (3 floats per point). AttributeTypeNormal AttributeType = 3 // AttributeTypeIntensity indicates intensity (1 float per point). AttributeTypeIntensity AttributeType = 4 // AttributeTypeRGBNormal indicates RGB color plus normal vectors. AttributeTypeRGBNormal AttributeType = 5 )
func (AttributeType) String ¶
func (t AttributeType) String() string
String returns a human-readable name for the attribute type.
type CompressionMode ¶
type CompressionMode uint8
CompressionMode defines the point cloud compression mode.
const ( // CompressionModeUnknown indicates an unrecognized compression mode. CompressionModeUnknown CompressionMode = 0 // CompressionModeLossless indicates lossless geometry and attribute coding. CompressionModeLossless CompressionMode = 1 // CompressionModeLossy indicates lossy compression with quality control. CompressionModeLossy CompressionMode = 2 // CompressionModeLearningBased indicates learning-based neural compression. CompressionModeLearningBased CompressionMode = 3 )
func (CompressionMode) IsValid ¶
func (m CompressionMode) IsValid() bool
IsValid returns true if the compression mode is recognized.
func (CompressionMode) String ¶
func (m CompressionMode) String() string
String returns a human-readable name for the compression mode.
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder decodes JPEG Pleno Point Cloud data. It supports lossless, lossy, and learning-based compression modes.
func NewDecoder ¶
NewDecoder creates a new point cloud decoder. It reads and parses the header immediately to validate the input.
func (*Decoder) Decode ¶
func (d *Decoder) Decode() (*PointCloud, error)
Decode decodes the point cloud and returns a PointCloud structure.
func (*Decoder) Header ¶
func (d *Decoder) Header() *PointCloudHeader
Header returns the parsed point cloud header.
func (*Decoder) SetReconstructionParams ¶
func (d *Decoder) SetReconstructionParams(params *ReconstructionParams)
SetReconstructionParams sets the parameters for learning-based reconstruction.
type GeometryStream ¶
type GeometryStream struct {
// Data contains the compressed geometry data.
Data []byte
// PointCount is the number of points in this stream.
PointCount int64
// GeometryType is the geometry representation type.
GeometryType GeometryType
// Offset is the byte offset in the file.
Offset int64
}
GeometryStream represents the compressed geometry data stream.
func (*GeometryStream) Validate ¶
func (g *GeometryStream) Validate() error
Validate checks that the geometry stream is valid.
type GeometryType ¶
type GeometryType uint8
GeometryType defines the geometry representation type.
const ( // GeometryTypeUnknown indicates an unrecognized geometry type. GeometryTypeUnknown GeometryType = 0 // GeometryTypeFloat32 indicates 32-bit floating-point coordinates. GeometryTypeFloat32 GeometryType = 1 // GeometryTypeFloat64 indicates 64-bit floating-point coordinates. GeometryTypeFloat64 GeometryType = 2 // GeometryTypeFixed16 indicates 16-bit fixed-point coordinates. GeometryTypeFixed16 GeometryType = 3 // GeometryTypeVoxel indicates voxel grid representation. GeometryTypeVoxel GeometryType = 4 )
func (GeometryType) String ¶
func (t GeometryType) String() string
String returns a human-readable name for the geometry type.
type OctreeNode ¶
type OctreeNode struct {
// Level is the depth level in the octree (0 = root).
Level int
// Index is the position of this node within its parent.
Index int
// Bounds is the bounding box for this node.
Bounds jpegpleno.BoundingBox3D
// PointCount is the number of points in this node.
PointCount int64
// IsLeaf indicates if this is a leaf node containing points.
IsLeaf bool
// ChildMask is a bitmask indicating which children exist (0-7).
ChildMask uint8
// Children contains pointers to child nodes (nil for leaf nodes).
Children [8]*OctreeNode
}
OctreeNode represents a node in an octree structure for point cloud. Octrees are commonly used for spatial organization of point clouds.
func (*OctreeNode) ChildCount ¶
func (n *OctreeNode) ChildCount() int
ChildCount returns the number of children.
func (*OctreeNode) HasChild ¶
func (n *OctreeNode) HasChild(index int) bool
HasChild returns true if the child at the given index exists.
func (*OctreeNode) Validate ¶
func (n *OctreeNode) Validate() error
Validate checks that the octree node is valid.
type Point ¶
type Point struct {
// Position is the 3D coordinate of the point.
Position jpegpleno.Point3DCoord
// Color is the RGB color (if HasColor is true in PointCloudInfo).
Color jpegpleno.Color3D
// Normal is the normal vector (if HasNormals is true in PointCloudInfo).
Normal jpegpleno.Normal3D
// Intensity is the intensity value (if HasIntensity is true in PointCloudInfo).
Intensity float32
}
Point represents a single 3D point with optional attributes.
func ExtractPoint ¶
func ExtractPoint(pc *PointCloud, index int) (*Point, error)
ExtractPoint extracts a single point from a decoded point cloud.
func ExtractPointRange ¶
func ExtractPointRange(pc *PointCloud, startIndex, count int) ([]Point, error)
ExtractPointRange extracts a range of points from the point cloud.
type PointCloud ¶
type PointCloud struct {
// Info contains metadata about this point cloud.
Info PointCloudInfo
// Points contains the decoded points.
Points []Point
}
PointCloud represents a decoded point cloud.
func (*PointCloud) GetPoint ¶
func (p *PointCloud) GetPoint(index int) (*Point, error)
GetPoint returns the point at the given index.
func (*PointCloud) GetWorldPosition ¶
func (p *PointCloud) GetWorldPosition(index int) (*jpegpleno.Point3DCoord, error)
GetWorldPosition returns the point position in world coordinates. Applies scale and offset from Info.
func (*PointCloud) Validate ¶
func (p *PointCloud) Validate() error
Validate checks that the point cloud data is valid.
type PointCloudHeader ¶
type PointCloudHeader struct {
// Version is the point cloud format version.
Version uint16
// CompressionMode is the compression mode used.
CompressionMode CompressionMode
// GeometryType is the geometry representation type.
GeometryType GeometryType
// AttributeType is the type of point attributes.
AttributeType AttributeType
// PointCount is the total number of points.
PointCount int64
// BoundingBox is the axis-aligned bounding box enclosing all points.
BoundingBox jpegpleno.BoundingBox3D
// CoordinatePrecision is the precision of coordinates (bits).
CoordinatePrecision int
// Scale is the scale factor for coordinates.
Scale float32
// GeometryOffset is the byte offset to geometry data.
GeometryOffset uint32
// AttributeOffset is the byte offset to attribute data.
AttributeOffset uint32
}
PointCloudHeader contains the parsed header information from a point cloud file.
func (*PointCloudHeader) Validate ¶
func (h *PointCloudHeader) Validate() error
Validate checks that the header values are valid.
type PointCloudInfo ¶
type PointCloudInfo struct {
// Bounds contains the bounding box and point count.
Bounds jpegpleno.PointCloudBounds
// CompressionMode is the compression mode used.
CompressionMode CompressionMode
// GeometryType is the geometry representation type.
GeometryType GeometryType
// AttributeType is the type of point attributes.
AttributeType AttributeType
// HasColors indicates if points have color information.
HasColors bool
// HasNormals indicates if points have normal vectors.
HasNormals bool
// HasIntensity indicates if points have intensity values.
HasIntensity bool
// CoordinatePrecision is the precision of coordinates (bits).
CoordinatePrecision int
// ColorPrecision is the precision of color values (bits per channel).
ColorPrecision int
// QualityLevel is the quality level for lossy compression (0-100).
QualityLevel int
// VoxelSize is the voxel size for voxel-based geometry (meters).
VoxelSize float64
// OriginOffset is the offset to add to coordinates for original position.
OriginOffset jpegpleno.Point3DCoord
// Scale is the scale factor to multiply coordinates.
Scale float64
}
PointCloudInfo contains information about a point cloud.
func (*PointCloudInfo) EstimatedDataSize ¶
func (i *PointCloudInfo) EstimatedDataSize() (int64, error)
EstimatedDataSize estimates the total data size in bytes.
func (*PointCloudInfo) PointCount ¶
func (i *PointCloudInfo) PointCount() int64
PointCount returns the number of points.
func (*PointCloudInfo) Validate ¶
func (i *PointCloudInfo) Validate() error
Validate checks that the point cloud info is valid.
type PointCloudSlice ¶
type PointCloudSlice struct {
// StartIndex is the starting point index in the full cloud.
StartIndex int64
// Count is the number of points in this slice.
Count int64
// Points contains the points in this slice.
Points []Point
}
PointCloudSlice represents a subset of points for streaming/chunked processing.
func (*PointCloudSlice) EndIndex ¶
func (s *PointCloudSlice) EndIndex() int64
EndIndex returns the ending point index (exclusive).
func (*PointCloudSlice) Validate ¶
func (s *PointCloudSlice) Validate() error
Validate checks that the point cloud slice is valid.
type ReconstructionParams ¶
type ReconstructionParams struct {
// ModelID identifies the neural network model to use.
ModelID string
// ModelVersion is the version of the model.
ModelVersion string
// QualityScale is a scale factor for quality (0.0-1.0).
QualityScale float32
// MaxIterations is the maximum number of reconstruction iterations.
MaxIterations int
// UseGPU indicates if GPU acceleration should be used.
UseGPU bool
}
ReconstructionParams contains parameters for learning-based reconstruction.
func NewDefaultReconstructionParams ¶
func NewDefaultReconstructionParams() *ReconstructionParams
NewDefaultReconstructionParams creates default reconstruction parameters.
func (*ReconstructionParams) Validate ¶
func (r *ReconstructionParams) Validate() error
Validate checks that reconstruction parameters are valid.