Geometrize 1.0
C++ library for geometrizing images into geometric primitives
Public Member Functions | Private Attributes | List of all members
geometrize::ImageRunner::ImageRunnerImpl Class Reference
Collaboration diagram for geometrize::ImageRunner::ImageRunnerImpl:
Collaboration graph
[legend]

Public Member Functions

 ImageRunnerImpl (const geometrize::Bitmap &targetBitmap)
 
 ImageRunnerImpl (const geometrize::Bitmap &targetBitmap, const geometrize::Bitmap &initialBitmap)
 
 ~ImageRunnerImpl ()=default
 
ImageRunnerImploperator= (const ImageRunnerImpl &)=delete
 
 ImageRunnerImpl (const ImageRunnerImpl &)=delete
 
std::vector< geometrize::ShapeResultstep (const geometrize::ImageRunnerOptions &options, std::function< std::shared_ptr< geometrize::Shape >()> shapeCreator, geometrize::core::EnergyFunction energyFunction, geometrize::ShapeAcceptancePreconditionFunction addShapePrecondition)
 
geometrize::BitmapgetCurrent ()
 
geometrize::BitmapgetTarget ()
 
const geometrize::BitmapgetCurrent () const
 
const geometrize::BitmapgetTarget () const
 
geometrize::ModelgetModel ()
 

Private Attributes

geometrize::Model m_model
 The model for the primitive optimization/fitting algorithm. More...
 

Constructor & Destructor Documentation

◆ ImageRunnerImpl() [1/3]

geometrize::ImageRunner::ImageRunnerImpl::ImageRunnerImpl ( const geometrize::Bitmap targetBitmap)
inline
22: m_model{targetBitmap} {}
geometrize::Model m_model
The model for the primitive optimization/fitting algorithm.
Definition: imagerunner.cpp:70

◆ ImageRunnerImpl() [2/3]

geometrize::ImageRunner::ImageRunnerImpl::ImageRunnerImpl ( const geometrize::Bitmap targetBitmap,
const geometrize::Bitmap initialBitmap 
)
inline
23: m_model{targetBitmap, initialBitmap} {}

◆ ~ImageRunnerImpl()

geometrize::ImageRunner::ImageRunnerImpl::~ImageRunnerImpl ( )
default

◆ ImageRunnerImpl() [3/3]

geometrize::ImageRunner::ImageRunnerImpl::ImageRunnerImpl ( const ImageRunnerImpl )
delete

Member Function Documentation

◆ getCurrent() [1/2]

geometrize::Bitmap & geometrize::ImageRunner::ImageRunnerImpl::getCurrent ( )
inline
45 {
46 return m_model.getCurrent();
47 }
geometrize::Bitmap & getCurrent()
getCurrent Gets the current bitmap.
Definition: model.cpp:267
Here is the call graph for this function:

◆ getCurrent() [2/2]

const geometrize::Bitmap & geometrize::ImageRunner::ImageRunnerImpl::getCurrent ( ) const
inline
55 {
56 return m_model.getCurrent();
57 }
Here is the call graph for this function:

◆ getModel()

geometrize::Model & geometrize::ImageRunner::ImageRunnerImpl::getModel ( )
inline
65 {
66 return m_model;
67 }

◆ getTarget() [1/2]

geometrize::Bitmap & geometrize::ImageRunner::ImageRunnerImpl::getTarget ( )
inline
50 {
51 return m_model.getTarget();
52 }
geometrize::Bitmap & getTarget()
getTarget Gets the target bitmap.
Definition: model.cpp:262
Here is the call graph for this function:

◆ getTarget() [2/2]

const geometrize::Bitmap & geometrize::ImageRunner::ImageRunnerImpl::getTarget ( ) const
inline
60 {
61 return m_model.getTarget();
62 }
Here is the call graph for this function:

◆ operator=()

ImageRunnerImpl & geometrize::ImageRunner::ImageRunnerImpl::operator= ( const ImageRunnerImpl )
delete

◆ step()

std::vector< geometrize::ShapeResult > geometrize::ImageRunner::ImageRunnerImpl::step ( const geometrize::ImageRunnerOptions options,
std::function< std::shared_ptr< geometrize::Shape >()>  shapeCreator,
geometrize::core::EnergyFunction  energyFunction,
geometrize::ShapeAcceptancePreconditionFunction  addShapePrecondition 
)
inline
32 {
33 const auto [xMin, yMin, xMax, yMax] = geometrize::commonutil::mapShapeBoundsToImage(options.shapeBounds, m_model.getTarget());
34 const geometrize::ShapeTypes types = options.shapeTypes;
35
36 if(!shapeCreator) {
37 shapeCreator = geometrize::createDefaultShapeCreator(types, xMin, yMin, xMax, yMax);
38 }
39
40 m_model.setSeed(options.seed);
41 return m_model.step(shapeCreator, options.alpha, options.shapeCount, options.maxShapeMutations, options.maxThreads, energyFunction, addShapePrecondition);
42 }
std::uint32_t shapeCount
The number of candidate shapes that will be tried per model step.
Definition: imagerunneroptions.h:32
std::uint32_t seed
The seed for the random number generators used by the image runner.
Definition: imagerunneroptions.h:34
geometrize::ShapeTypes shapeTypes
The shape types that the image runner shall use.
Definition: imagerunneroptions.h:30
std::uint32_t maxShapeMutations
The maximum number of times each candidate shape will be modified to attempt to find a better fit.
Definition: imagerunneroptions.h:33
ImageRunnerShapeBoundsOptions shapeBounds
If zero or do not form a rectangle, the entire target image is used i.e. (0, 0, imageWidth,...
Definition: imagerunneroptions.h:36
std::uint8_t alpha
The alpha/opacity of the shapes (0-255).
Definition: imagerunneroptions.h:31
std::uint32_t maxThreads
The maximum number of separate threads for the implementation to use. 0 lets the implementation choos...
Definition: imagerunneroptions.h:35
void setSeed(std::uint32_t seed)
setSeed Sets the seed that the random number generators of this model use. Note that the model also u...
Definition: model.cpp:282
std::vector< geometrize::ShapeResult > step(const std::function< std::shared_ptr< geometrize::Shape >(void)> &shapeCreator, std::uint8_t alpha, std::uint32_t shapeCount, std::uint32_t maxShapeMutations, std::uint32_t maxThreads, const geometrize::core::EnergyFunction &energyFunction=nullptr, const geometrize::ShapeAcceptancePreconditionFunction &addShapePrecondition=nullptr)
step Steps the primitive optimization/fitting algorithm.
Definition: model.cpp:245
std::tuple< std::int32_t, std::int32_t, std::int32_t, std::int32_t > mapShapeBoundsToImage(const geometrize::ImageRunnerShapeBoundsOptions &options, const geometrize::Bitmap &image)
mapShapeBoundsToImage Maps the given shape bound percentages to the given image, returning a bounding...
Definition: commonutil.cpp:75
ShapeTypes
The ShapeTypes enum specifies the types of shapes that can be used. These can be combined to produce ...
Definition: shapetypes.h:17
std::function< std::shared_ptr< geometrize::Shape >()> createDefaultShapeCreator(const geometrize::ShapeTypes types, const std::int32_t xMin, const std::int32_t yMin, const std::int32_t xMax, const std::int32_t yMax)
createDefaultShapeCreator Creates an instance of the default shape creator object....
Definition: shapefactory.cpp:25
Here is the call graph for this function:

Member Data Documentation

◆ m_model

geometrize::Model geometrize::ImageRunner::ImageRunnerImpl::m_model
private

The model for the primitive optimization/fitting algorithm.


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