-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | PCD file loader. -- -- Parser for PCD (point cloud data) formats. See -- http://pointclouds.org/documentation/tutorials/pcd_file_format.php -- for more information. @package pcd-loader @version 0.1.1.1 -- | Common types for dealing with PCD files. module PCD.Internal.Types -- | A 2-dimensional vector data V2 a :: * -> * V2 :: a -> a -> V2 a -- | A 3-dimensional vector data V3 a :: * -> * V3 :: a -> a -> a -> V3 a -- | A 4-dimensional vector. data V4 a :: * -> * V4 :: a -> a -> a -> a -> V4 a type M44 a = V4 (V4 a) data Quaternion a :: * -> * Quaternion :: a -> {-# UNPACK #-} !(V3 a) -> Quaternion a -- | Storable-based vectors data Vector a :: * -> * -- | 8-bit unsigned integer type data Word8 :: * -- | Define a data structure for a PCD file header and an associated -- parser. module PCD.Header -- | Fields attached to a point may be signed integers (I), unsigned -- integers (U), or floating point (F). data DimType I :: DimType U :: DimType F :: DimType -- | The PCD format has both ASCII and binary variants. data DataFormat ASCII :: DataFormat Binary :: DataFormat data FieldType TUchar :: Word8 -> FieldType TChar :: Int8 -> FieldType TUshort :: Word16 -> FieldType TShort :: Int16 -> FieldType TUint :: Word32 -> FieldType TInt :: Int32 -> FieldType TFloat :: Float -> FieldType TDouble :: Double -> FieldType -- | Construct a parser for a field based on its type and size. fieldParser :: DimType -> Int -> Parser FieldType -- | Assemble a parser for points by sequencing together all necessary -- field parsers. pointParser :: Header -> Parser [FieldType] data Header Header :: Text -> [Text] -> [Int] -> [DimType] -> [Int] -> Integer -> Int -> (V3 Double, Quaternion Double) -> Integer -> DataFormat -> Header _version :: Header -> Text _fields :: Header -> [Text] _sizes :: Header -> [Int] _dimTypes :: Header -> [DimType] _counts :: Header -> [Int] _width :: Header -> Integer _height :: Header -> Int _viewpoint :: Header -> (V3 Double, Quaternion Double) _points :: Header -> Integer _format :: Header -> DataFormat width :: Lens Header Header Integer Integer viewpoint :: Lens Header Header (V3 Double, Quaternion Double) (V3 Double, Quaternion Double) version :: Lens Header Header Text Text sizes :: Lens Header Header [Int] [Int] points :: Lens Header Header Integer Integer height :: Lens Header Header Int Int format :: Lens Header Header DataFormat DataFormat fields :: Lens Header Header [Text] [Text] dimTypes :: Lens Header Header [DimType] [DimType] counts :: Lens Header Header [Int] [Int] defaultHeader :: Header readVersion :: Parser Text readFields :: Parser [Text] readTypes :: Parser [DimType] namedIntegral :: Integral a => Text -> Parser a namedIntegrals :: Integral a => Text -> Parser [a] readViewpoint :: Parser (V3 Double, Quaternion Double) readFormat :: Parser DataFormat -- | Get the next non-comment line. nextLine :: Handle -> IO Text -- | Parse a PCD header. Returns the Header and the rest of the file -- contents. readHeader :: Handle -> IO (Header, Maybe Text) -- | Format a Header to be compatible with the PCD specification. writeHeader :: Header -> Text instance NFData Header instance Eq DimType instance Show DimType instance Ord DimType instance Eq DataFormat instance Show DataFormat instance Ord DataFormat instance Show Header -- | Parser for PCD (point cloud data) files. Also provides a facility for -- converting from ASCII to binary formatted point data. module PCD.Data -- | Read point data using a user-supplied ASCII point parser. readAsciiPoints :: Vector v a => Header -> Handle -> Parser a -> IO (v a) -- | Load points of unknown dimension into a boxed vector with a list of -- FieldType as the point representation. readAsciiPointsDefault :: Header -> Handle -> IO (Vector [FieldType]) -- | Read back Storable points saved as binary data. readBinPoints :: Storable a => Header -> Handle -> IO (Either String (Vector a)) -- | Reads point data in either ASCII or binary formats given an ASCII -- parser for the point data type and a Storable instance. If you -- know that your points are binary or ASCII, consider using -- readBinPoints or readAsciiPoints. readPointData :: Storable a => Header -> Handle -> Parser a -> IO (Either String (Vector a)) -- | Parse 3D points serialized in ASCII. readXYZ_ascii :: Fractional a => Parser (V3 a) -- | Parse 4D points serialized to ASCII. This is useful for points with -- X,Y,Z, and RGB fields each represented by a single float. readXYZW_ascii :: Fractional a => Parser (V4 a) -- | Use an existing PCD header to save binary point data to a file. The -- supplied header is used as-is, except that its format is set to -- Binary. saveBinaryPcd :: Storable a => FilePath -> Header -> Vector a -> IO () -- | Convert the single-precision floating point XYZ or XYZW (where "W" may -- be an RGB triple encoded as a single float) points in an ASCII PCD to -- a binary PCD file. asciiToBinary :: FilePath -> FilePath -> IO () -- | Load points stored in a PCD file into a Vector. loadPoints :: Storable a => Parser a -> FilePath -> IO (Vector a) -- | Read a PCD file consisting of floating point XYZ coordinates for each -- point. loadXyz :: (Fractional a, Storable a) => FilePath -> IO (Vector (V3 a)) -- | Read a PCD file consisting of floating point XYZW coordinates for each -- point (where the final "W" field may be an RGB triple encoded as a -- float). loadXyzw :: (Fractional a, Storable a) => FilePath -> IO (Vector (V4 a))