Geometrize 1.0
C++ library for geometrizing images into geometric primitives
Namespaces | Functions
core.cpp File Reference
#include "core.h"
#include <cassert>
#include <cmath>
#include <cstdint>
#include <functional>
#include <memory>
#include <vector>
#include "bitmap/bitmap.h"
#include "bitmap/rgba.h"
#include "commonutil.h"
#include "rasterizer/rasterizer.h"
#include "rasterizer/scanline.h"
#include "shape/shape.h"
#include "state.h"

Namespaces

namespace  geometrize
 
namespace  geometrize::core
 

Functions

double geometrize::core::defaultEnergyFunction (const std::vector< geometrize::Scanline > &lines, const std::uint32_t alpha, const geometrize::Bitmap &target, const geometrize::Bitmap &current, geometrize::Bitmap &buffer, double score)
 defaultEnergyFunction The default/built-in energy function that calculates a measure of the improvement adding the scanlines of a shape provides - lower energy is better. More...
 
geometrize::rgba geometrize::core::computeColor (const geometrize::Bitmap &target, const geometrize::Bitmap &current, const std::vector< geometrize::Scanline > &lines, std::uint8_t alpha)
 computeColor Calculates the color of the scanlines. More...
 
double geometrize::core::differenceFull (const geometrize::Bitmap &first, const geometrize::Bitmap &second)
 differenceFull Calculates the root-mean-square error between two bitmaps. More...
 
double geometrize::core::differencePartial (const geometrize::Bitmap &target, const geometrize::Bitmap &before, const geometrize::Bitmap &after, double score, const std::vector< Scanline > &lines)
 differencePartial Calculates the root-mean-square error between the parts of the two bitmaps within the scanline mask. This is for optimization purposes, it lets us calculate new error values only for parts of the image we know have changed. More...
 
geometrize::State geometrize::core::bestHillClimbState (const std::function< std::shared_ptr< geometrize::Shape >(void)> &shapeCreator, std::uint32_t alpha, std::uint32_t n, std::uint32_t age, const geometrize::Bitmap &target, const geometrize::Bitmap &current, geometrize::Bitmap &buffer, double lastScore, const EnergyFunction &customEnergyFunction=nullptr)
 bestHillClimbState Gets the best state using a hill climbing algorithm. More...