bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
wheel_odometry::FloorImage Class Reference

An image of the floor, centred on the world origin. More...

#include <downward_camera.h>

Public Member Functions

 FloorImage (const cv::Mat &image, real_t width)
 Constructor.
void write_texture (const std::string &path) const
 Write the image as a colour PNG, for a texture: Irrlicht reads colour pictures more reliably than grey ones. Throws if the file cannot be written.
const cv::Mat & image () const noexcept
real_t width () const noexcept
 The width of the floor, along x [m].
real_t height () const noexcept
 The height of the floor, along y [m].
real_t metres_per_pixel () const noexcept
 The size of a pixel [m].
cv::Point2d to_pixel (real_t x, real_t y) const
 The pixel, with fractions, at the given point of the floor.
std::array< real_t, 2 > to_world (const cv::Point2d &pixel) const
 The point of the floor at the given pixel, with fractions.
real_t reflectance (real_t x, real_t y) const
 How bright the floor is at a point, from 0 for black to 1 for white: the brightness of the pixel there. Outside the image the floor is white. An infrared element looking at the floor reads this, see backends::CHRONO_InfraredBackend.

Static Public Member Functions

static FloorImage draw (real_t width, real_t height, real_t metres_per_pixel, const std::function< bool(real_t, real_t)> &is_ink, uchar paper=235, uchar ink=25)
 Draw a floor: a grey picture of width x height metres of paper, with ink wherever is_ink(x, y) is true.

Detailed Description

An image of the floor, centred on the world origin.

The image covers width() x height() metres of the floor. Its centre is at the origin, its columns grow with x and its rows grow against y, so the top of the image is the side of the floor with the largest y.

Constructor & Destructor Documentation

◆ FloorImage()

bitsim::sensors::FloorImage::FloorImage ( const cv::Mat & image,
real_t width )

Constructor.

Parameters
imageThe image of the floor
widthThe width of the floor the image covers, along x [m]

Member Function Documentation

◆ draw()

FloorImage bitsim::sensors::FloorImage::draw ( real_t width,
real_t height,
real_t metres_per_pixel,
const std::function< bool(real_t, real_t)> & is_ink,
uchar paper = 235,
uchar ink = 25 )
static

Draw a floor: a grey picture of width x height metres of paper, with ink wherever is_ink(x, y) is true.

Parameters
widthThe width of the floor, along x [m]
heightThe height of the floor, along y [m]
metres_per_pixelThe size of a pixel [m]
is_inkWhether the point (x, y) of the floor is inked
paperThe brightness of the paper, 0 to 255
inkThe brightness of the ink

◆ height()

real_t bitsim::sensors::FloorImage::height ( ) const
inlinenoexcept

The height of the floor, along y [m].

◆ image()

const cv::Mat & bitsim::sensors::FloorImage::image ( ) const
inlinenoexcept

◆ metres_per_pixel()

The size of a pixel [m].

◆ reflectance()

How bright the floor is at a point, from 0 for black to 1 for white: the brightness of the pixel there. Outside the image the floor is white. An infrared element looking at the floor reads this, see backends::CHRONO_InfraredBackend.

◆ to_pixel()

The pixel, with fractions, at the given point of the floor.

◆ to_world()

std::array< real_t, 2 > bitsim::sensors::FloorImage::to_world ( const cv::Point2d & pixel) const

The point of the floor at the given pixel, with fractions.

◆ width()

real_t bitsim::sensors::FloorImage::width ( ) const
inlinenoexcept

The width of the floor, along x [m].

◆ write_texture()

void bitsim::sensors::FloorImage::write_texture ( const std::string & path) const

Write the image as a colour PNG, for a texture: Irrlicht reads colour pictures more reliably than grey ones. Throws if the file cannot be written.


The documentation for this class was generated from the following files: