Geometrize  1.0
C++ library for geometrizing images into geometric primitives
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
imagerunner.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <functional>
4 #include <memory>
5 #include <vector>
6 
7 #include "../core.h"
8 #include "../shaperesult.h"
9 
10 namespace geometrize
11 {
12 class Bitmap;
13 class ImageRunnerOptions;
14 class Model;
15 class Shape;
16 }
17 
18 namespace geometrize
19 {
20 
26 {
27 public:
32  ImageRunner(const geometrize::Bitmap& targetBitmap);
33 
40  ImageRunner(const geometrize::Bitmap& targetBitmap, const geometrize::Bitmap& initialBitmap);
41  ~ImageRunner();
42  ImageRunner& operator=(const ImageRunner&) = delete;
43  ImageRunner(const ImageRunner&) = delete;
44 
52  std::vector<geometrize::ShapeResult> step(const geometrize::ImageRunnerOptions& options,
53  std::function<std::shared_ptr<geometrize::Shape>()> shapeCreator = nullptr,
54  geometrize::core::EnergyFunction energyFunction = nullptr);
55 
61 
67 
72  const geometrize::Bitmap& getCurrent() const;
73 
78  const geometrize::Bitmap& getTarget() const;
79 
85 
86 private:
88  std::unique_ptr<ImageRunner::ImageRunnerImpl> d;
89 };
90 
91 }
The ImageRunner class is a helper class for creating a set of primitives from a source image...
Definition: imagerunner.h:25
Definition: imagerunner.cpp:18
~ImageRunner()
Definition: imagerunner.cpp:78
std::vector< geometrize::ShapeResult > step(const geometrize::ImageRunnerOptions &options, std::function< std::shared_ptr< geometrize::Shape >()> shapeCreator=nullptr, geometrize::core::EnergyFunction energyFunction=nullptr)
step Updates the internal model once.
Definition: imagerunner.cpp:81
ImageRunner & operator=(const ImageRunner &)=delete
ImageRunner(const geometrize::Bitmap &targetBitmap)
ImageRunner Creates an new image runner with the given target bitmap. Uses the average color of the t...
Definition: imagerunner.cpp:70
The ImageRunnerOptions class encapsulates preferences/options that the image runner uses...
Definition: imagerunneroptions.h:14
geometrize::Bitmap & getCurrent()
getCurrent Gets the current bitmap with the primitives drawn on it.
Definition: imagerunner.cpp:86
The Model class is the model for the core optimization/fitting algorithm.
Definition: model.h:24
geometrize::Model & getModel()
getModel Gets the underlying model.
Definition: imagerunner.cpp:106
geometrize::Bitmap & getTarget()
getTarget Gets the target bitmap.
Definition: imagerunner.cpp:91
The Bitmap class is a helper class for working with bitmap data.
Definition: bitmap.h:15
std::unique_ptr< ImageRunner::ImageRunnerImpl > d
Definition: imagerunner.h:87
std::function< double(const std::vector< geometrize::Scanline > &lines, const std::uint32_t alpha, const geometrize::Bitmap &target, const geometrize::Bitmap &current, geometrize::Bitmap &buffer, double score)> EnergyFunction
EnergyFunction Type alias for a function that calculates a measure of the improvement adding the scan...
Definition: core.h:44