Template Class Texturizer

Inheritance Relationships

Derived Types

Class Documentation

template<typename BaseVecT>
class Texturizer

Class that performs texture-related tasks.

Subclassed by lvr2::RaycastingTexturizer< BaseVecT >, lvr2::SpectralTexturizer< BaseVecT >

Public Functions

Texturizer(float texelSize, int texMinClusterSize, int texMaxClusterSize)

Constructor.

Parameters:
  • texelSize – The size of one texture pixel, relative to the coordinate system of the point cloud

  • texMinClusterSize – The minimum number of faces a cluster needs to be texturized

  • texMaxClusterSize – The maximum number of faces a cluster needs to be texturized

Texture getTexture(TextureHandle h)

Get the texture to a given texture handle.

Parameters:

h – The texture handle

Returns:

The texture

StableVector<TextureHandle, Texture> getTextures()

Returns all textures.

Returns:

A StableVector containing all textures

int getTextureIndex(TextureHandle h)

Get the texture index to a given texture handle.

Parameters:

h – The texture handle

Returns:

The texture index

void findKeyPointsInTexture(const TextureHandle texH, const BoundingRectangle<typename BaseVecT::CoordType> &boundingRect, const cv::Ptr<cv::Feature2D> &detector, std::vector<cv::KeyPoint> &keypoints, cv::Mat &descriptors)

Discover keypoints in a texture.

Parameters:
  • texH[in] Texture handle

  • boundingRect[in] Bounding rectangle computed for the texture

  • detector[in] Feature detector to use (any of cv::Feature2D)

  • keypoints[out] Vector of keypoints

  • descriptors[out] Matrix of descriptors for the keypoint

std::vector<BaseVecT> keypoints23d(const std::vector<cv::KeyPoint> &keypoints, const BoundingRectangle<typename BaseVecT::CoordType> &boundingRect, const TextureHandle &h)

Compute 3D coordinates for texture-relative keypoints.

Parameters:
  • keypoints[in] Keypoints in image coordinates

  • boundingRect[in] Bounding rectangle of the texture embedded in 3D

Returns:

Vector of 3D coordinates of all keypoints

virtual TextureHandle generateTexture(int index, const PointsetSurface<BaseVecT> &surface, const BoundingRectangle<typename BaseVecT::CoordType> &boundingRect, ClusterHandle cluster)

Generates a texture for a given bounding rectangle.

Create a grid, based on given information (texel size, bounding rectangle). For each cell in the grid (which represents a texel), let the PointsetSurface find the closest point in the point cloud and use that point’s color as color for the texel.

Parameters:
  • index – The index the texture will get

  • surface – The point cloud

  • boundingRect – The bounding rectangle of the cluster

  • cluster – The cluster being texturized

Returns:

Texture handle of the generated texture

TexCoords calculateTexCoords(TextureHandle texH, const BoundingRectangle<typename BaseVecT::CoordType> &boundingRect, BaseVecT v)

Calculate texture coordinates for a given 3D point in a texture.

Parameters:
  • texH – The texture handle

  • boundingRect – The bounding rectangle of the texture

  • v – The 3D point

Returns:

The texture coordinates

BaseVecT calculateTexCoordsInv(TextureHandle texH, const BoundingRectangle<typename BaseVecT::CoordType> &boundingRect, const TexCoords &coords)

Calculate a global 3D position for given texture coordinates.

Parameters:
  • texH – The texture handle

  • boundingRect – The bounding rectangle of the texture

  • coords – The texture coordinates

Returns:

The 3D point

void saveTextures()

Calls the save method for each texture.

Public Members

const float m_texelSize

The size of a texture pixel.

const int m_texMinClusterSize

The minimum number of faces a cluster needs to be texturized.

const int m_texMaxClusterSize

The maximum number of faces a cluster needs to be texturized.

Protected Attributes

StableVector<TextureHandle, Texture> m_textures

StableVector, that contains all generated textures with texture handles.