Blender V4.3
Freestyle::SteerableViewMap Class Reference

#include <SteerableViewMap.h>

Public Member Functions

 SteerableViewMap (uint nbOrientations=4)
 
 SteerableViewMap (const SteerableViewMap &iBrother)
 
virtual ~SteerableViewMap ()
 
virtual void Reset ()
 
doubleAddFEdge (FEdge *iFEdge)
 
double ComputeWeight (const Vec2d &dir, uint iNOrientation)
 
uint getSVMNumber (Vec2f dir)
 
uint getSVMNumber (uint id)
 
void buildImagesPyramids (GrayImage **steerableBases, bool copy=false, uint iNbLevels=4, float iSigma=1.0f)
 
float readSteerableViewMapPixel (uint iOrientation, int iLevel, int x, int y)
 
float readCompleteViewMapPixel (int iLevel, int x, int y)
 
uint getNumberOfPyramidLevels () const
 
uint getNumberOfOrientations () const
 
void saveSteerableViewMap () const
 

Protected Member Functions

void Clear ()
 
void Build ()
 

Protected Attributes

map< uint, double * > _mapping
 
uint _nbOrientations
 
ImagePyramid ** _imagesPyramids
 
double _bound
 
vector< Vec2d_directions
 

Detailed Description

This class checks for every FEdge in which steerable it belongs and stores the mapping allowing to retrieve this information from the FEdge Id.

Definition at line 36 of file SteerableViewMap.h.

Constructor & Destructor Documentation

◆ SteerableViewMap() [1/2]

Freestyle::SteerableViewMap::SteerableViewMap ( uint nbOrientations = 4)

Definition at line 33 of file SteerableViewMap.cpp.

References _bound, _directions, _nbOrientations, Build(), cos(), and M_PI.

◆ SteerableViewMap() [2/2]

Freestyle::SteerableViewMap::SteerableViewMap ( const SteerableViewMap & iBrother)

Definition at line 51 of file SteerableViewMap.cpp.

References _bound, _directions, _imagesPyramids, _mapping, and _nbOrientations.

◆ ~SteerableViewMap()

Freestyle::SteerableViewMap::~SteerableViewMap ( )
virtual

Definition at line 66 of file SteerableViewMap.cpp.

References Clear().

Member Function Documentation

◆ AddFEdge()

double * Freestyle::SteerableViewMap::AddFEdge ( FEdge * iFEdge)

Adds a FEdge to steerable VM. Returns the nbOrientations weights corresponding to the FEdge contributions to the nbOrientations directional maps.

Definition at line 111 of file SteerableViewMap.cpp.

References _mapping, _nbOrientations, ComputeWeight(), Freestyle::Id::getFirst(), Freestyle::FEdge::getId(), Freestyle::VecMat::Vec< T, N >::norm(), norm(), Freestyle::FEdge::orientation2d(), Freestyle::VecMat::Vec3< T >::x(), and Freestyle::VecMat::Vec3< T >::y().

Referenced by Freestyle::Controller::ComputeSteerableViewMap().

◆ Build()

void Freestyle::SteerableViewMap::Build ( )
protected

Definition at line 44 of file SteerableViewMap.cpp.

References _imagesPyramids, and _nbOrientations.

Referenced by Reset(), and SteerableViewMap().

◆ buildImagesPyramids()

void Freestyle::SteerableViewMap::buildImagesPyramids ( GrayImage ** steerableBases,
bool copy = false,
uint iNbLevels = 4,
float iSigma = 1.0f )

Builds _nbOrientations+1 pyramids of images from the _nbOrientations+1 base images of the steerable viewmap.

Parameters
steerableBasesThe _nbOrientations+1 images constituting the basis for the steerable pyramid.
copyIf false, the data is not duplicated, and Canvas deals with the memory management of these _nbOrientations+1 images. If true, data is copied, and it's up to the caller to delete the images.
iNbLevelsThe number of levels desired for each pyramid. If iNbLevels == 0, the complete pyramid is built.
iSigmaThe sigma that will be used for the gaussian blur

Definition at line 177 of file SteerableViewMap.cpp.

References _imagesPyramids, _nbOrientations, and copy().

Referenced by Freestyle::Controller::ComputeSteerableViewMap().

◆ Clear()

void Freestyle::SteerableViewMap::Clear ( )
protected

Definition at line 71 of file SteerableViewMap.cpp.

References _imagesPyramids, _mapping, and _nbOrientations.

Referenced by Reset(), and ~SteerableViewMap().

◆ ComputeWeight()

double Freestyle::SteerableViewMap::ComputeWeight ( const Vec2d & dir,
uint iNOrientation )

Compute the weight of direction dir for orientation iNOrientation

Definition at line 98 of file SteerableViewMap.cpp.

References _bound, _directions, _nbOrientations, cos(), and fabs().

Referenced by AddFEdge(), and getSVMNumber().

◆ getNumberOfOrientations()

uint Freestyle::SteerableViewMap::getNumberOfOrientations ( ) const
inline

Returns the number of orientations

Definition at line 128 of file SteerableViewMap.h.

References _nbOrientations.

Referenced by Freestyle::Controller::displayDensityCurves().

◆ getNumberOfPyramidLevels()

uint Freestyle::SteerableViewMap::getNumberOfPyramidLevels ( ) const

Returns the number of levels in the pyramids

Definition at line 221 of file SteerableViewMap.cpp.

References _imagesPyramids, and Freestyle::ImagePyramid::getNumberOfLevels().

Referenced by Freestyle::Controller::displayDensityCurves().

◆ getSVMNumber() [1/2]

uint Freestyle::SteerableViewMap::getSVMNumber ( uint id)

Returns the number of the SVM to which a FEdge belongs most.

Parameters
idThe First element of the Id struct of the FEdge we're interested in.

Definition at line 158 of file SteerableViewMap.cpp.

References _mapping, _nbOrientations, and w().

◆ getSVMNumber() [2/2]

uint Freestyle::SteerableViewMap::getSVMNumber ( Vec2f dir)

Returns the number of the SVM to which a direction belongs to.

Parameters
dirThe direction

Definition at line 138 of file SteerableViewMap.cpp.

References _nbOrientations, ComputeWeight(), Freestyle::VecMat::Vec< T, N >::norm(), norm(), and w().

Referenced by Freestyle::Functions1D::GetSteerableViewMapDensityF1D::operator()().

◆ readCompleteViewMapPixel()

float Freestyle::SteerableViewMap::readCompleteViewMapPixel ( int iLevel,
int x,
int y )

Reads a pixel in the one of the level of the pyramid containing the images of the complete ViewMap. Returns a value between 0 and 1. Equivalent to : readSteerableViewMapPixel(nbOrientations, x, y)

Definition at line 216 of file SteerableViewMap.cpp.

References _nbOrientations, and readSteerableViewMapPixel().

Referenced by Freestyle::Functions0D::GetViewMapGradientNormF0D::operator()(), Freestyle::Functions0D::ReadCompleteViewMapPixelF0D::operator()(), and Freestyle::ContextFunctions::ReadCompleteViewMapPixelCF().

◆ readSteerableViewMapPixel()

float Freestyle::SteerableViewMap::readSteerableViewMapPixel ( uint iOrientation,
int iLevel,
int x,
int y )

Reads a pixel value in one of the VewMap density steerable pyramids. Returns a value between 0 and 1.

Parameters
iOrientationthe number telling which orientation we need to check. There are _nbOrientations+1 oriented ViewMaps: 0 -> the ViewMap containing every horizontal lines 1 -> the ViewMap containing every lines whose orientation is around PI/4 2 -> the ViewMap containing every vertical lines 3 -> the ViewMap containing every lines whose orientation is around 3PI/4 4 -> the complete ViewMap
iLevelThe level of the pyramid we want to read
xThe abscissa of the desired pixel specified in level0 coordinate system. The origin is the lower left corner.
yThe ordinate of the desired pixel specified in level0 coordinate system. The origin is the lower left corner.

Definition at line 195 of file SteerableViewMap.cpp.

References _imagesPyramids, G, G_DEBUG_FREESTYLE, Freestyle::ImagePyramid::height(), Freestyle::ImagePyramid::pixel(), v, and Freestyle::ImagePyramid::width().

Referenced by Freestyle::Controller::displayDensityCurves(), Freestyle::Functions0D::ReadSteerableViewMapPixelF0D::operator()(), Freestyle::Functions1D::GetSteerableViewMapDensityF1D::operator()(), readCompleteViewMapPixel(), and Freestyle::ContextFunctions::ReadDirectionalViewMapPixelCF().

◆ Reset()

void Freestyle::SteerableViewMap::Reset ( )
virtual

Resets everything

Definition at line 92 of file SteerableViewMap.cpp.

References Build(), and Clear().

Referenced by Freestyle::Canvas::Clear(), Freestyle::Controller::ComputeSteerableViewMap(), and Freestyle::Canvas::Erase().

◆ saveSteerableViewMap()

Member Data Documentation

◆ _bound

double Freestyle::SteerableViewMap::_bound
protected

Definition at line 45 of file SteerableViewMap.h.

Referenced by ComputeWeight(), SteerableViewMap(), and SteerableViewMap().

◆ _directions

vector<Vec2d> Freestyle::SteerableViewMap::_directions
protected

Definition at line 46 of file SteerableViewMap.h.

Referenced by ComputeWeight(), SteerableViewMap(), and SteerableViewMap().

◆ _imagesPyramids

ImagePyramid** Freestyle::SteerableViewMap::_imagesPyramids
protected

◆ _mapping

map<uint, double *> Freestyle::SteerableViewMap::_mapping
protected

Definition at line 40 of file SteerableViewMap.h.

Referenced by AddFEdge(), Clear(), getSVMNumber(), and SteerableViewMap().

◆ _nbOrientations


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