waterlinkedsonar
C++ client library for the Water Linked Sonar 3D-15
Loading...
Searching...
No Matches
Enumerations | Functions
conversions.hpp File Reference

Conversions of decoded images to distances, point clouds and linear signal strength. More...

#include <cstdint>
#include <vector>
#include <waterlinkedsonar/rip/messages.hpp>

Go to the source code of this file.

Enumerations

enum class  waterlinked::sonar::PointLayout : std::uint8_t { ORGANIZED , UNORGANIZED }
 Layout of the point cloud produced by range_image_to_points(). More...
 

Functions

bool waterlinked::sonar::range_image_to_distances (const RangeImageView &image, std::vector< float > &distances)
 Converts a range image to per-pixel distances in meters, 0 where a pixel has no reflection.
 
bool waterlinked::sonar::range_image_to_points (const RangeImageView &image, std::vector< float > &points, PointLayout layout)
 Converts a range image to x, y, z triples in meters.
 
bool waterlinked::sonar::bitmap_to_strength_linear (const BitmapImageView &image, std::vector< std::uint16_t > &strength)
 Converts a SIGNAL_STRENGTH bitmap to 15-bit linear signal strength, 0 where a pixel has no reflection.
 

Detailed Description

Conversions of decoded images to distances, point clouds and linear signal strength.

Each function resizes its output vector and leaves it empty when the image is inconsistent. Reusing an output vector across calls avoids reallocating it.

Enumeration Type Documentation

◆ PointLayout

enum class waterlinked::sonar::PointLayout : std::uint8_t
strong

Layout of the point cloud produced by range_image_to_points().

Enumerator
ORGANIZED 

One point per pixel in row-major order; NaN where a pixel has no reflection.

UNORGANIZED 

One point per pixel with a reflection, in row-major order.

Function Documentation

◆ bitmap_to_strength_linear()

bool waterlinked::sonar::bitmap_to_strength_linear ( const BitmapImageView &  image,
std::vector< std::uint16_t > &  strength 
)

Converts a SIGNAL_STRENGTH bitmap to 15-bit linear signal strength, 0 where a pixel has no reflection.

Returns
false if the pixel count is not width * height.

◆ range_image_to_distances()

bool waterlinked::sonar::range_image_to_distances ( const RangeImageView &  image,
std::vector< float > &  distances 
)

Converts a range image to per-pixel distances in meters, 0 where a pixel has no reflection.

Returns
false if the pixel count is not width * height.

◆ range_image_to_points()

bool waterlinked::sonar::range_image_to_points ( const RangeImageView &  image,
std::vector< float > &  points,
PointLayout  layout 
)

Converts a range image to x, y, z triples in meters.

Pixel (px, py) at distance d maps to yaw = px / (width - 1) * fov_h - fov_h / 2 and pitch = py / (height - 1) * fov_v - fov_v / 2, and to (d cos(pitch) cos(yaw), d cos(pitch) sin(yaw), -d sin(pitch)).

Returns
false if width or height is below 2 or the pixel count is not width * height.