57 const std::string&
name,
60 bool linearInterp =
true
79 inline void setRotation(
int quarterTurns) { this->rotation = quarterTurns; }
100 std::map<std::string, std::string>
serialize()
const;
A key-value pair set storing pieces of arbitrary data (chunks) under string keys.
Stores linked GLSL programs and their associated fragment shader codes.
GLSL program to render images Makes use of default vertex attributes to pass the texture coordinates ...
Internal low-level GPU control API.
Abstract neural net operation (layer).
Image preprocessing operation.
void prepare(GraphicPipeline &gpu, ChunkCollection &data, GL::ProgramBank &bank)
Compiles GLSL shaders.
Size getOutputSize(int outputIndex=0) const
Returns full size of a specific operation output.
void execute(TaskThread &thread, GraphicPipeline &gpu)
Executes the operation.
bool getCenterCrop() const
bool linearInterpolation
if true, the input image is linearly interpolated when possible
void getOutput(GL::TextureHandler *&texture, int index=0)
Returns a GL::TextureHandler bound to a specific operation output.
bool acceptsTextureOutput(int index=0) const
Returns true if the operation can take a GL::TextureHandler at a specific output.
std::map< std::string, std::string > serialize() const
Returns a serialized representation of th operation;.
void setOutput(GL::TextureHandler &texture, int outputIndex=0)
int getRotation() const
Returns rotation applied to the input image.
static bool initDeserializer()
Sets up deserialization of the operation.
bool acceptsTextureInput(int index=0) const
Returns true if the operation can take a GL::TextureHandler at a specific input.
void setCenterCrop(bool enable)
Enables / disables center crop.
GL::TextureHandler * output
void setLinearInterpolation(bool enable)
Enables / disables linear interpolation.
int getOutputCount() const
Returns number of operation outputs.
int getInputPadding(int index=0) const
Retrieves minimum required size of zero padding for a given input.
bool centerCrop
if true, a center crop is performed to sample the output image from the input; otherwise the input is...
GL::TextureHandler * input
void disconnect()
Assigns empty inputs and outputs.
void setRotation(int quarterTurns)
Specifies a rotation to apply to the input image.
ImageSampler(const std::string &name, const IntPoint &size, bool centerCrop=true, bool linearInterp=true)
Creates an instance of image preprocessing operation.
GL::RenderingProgram * program
int rotation
clockwise rotation to apply to the input image; 1 unit = 90 degrees
void getSampledChannels(int index, int &min, int &max) const
Retrieves range of input features channels sampled at the same time for a specific input.
bool getLinearInterpolation() const
int getInputCount() const
Returns number of operation inputs.
void setInput(GL::TextureHandler &texture, int inputIndex=0)
unsigned long countTexelFetches() const
Counts (approximate) number of texels fetches.
Operation 3D input/output size.
static const bool IMAGESAMPLER_OP_DESERIALIZABLE
CustomPoint< numeric > min(const CustomPoint< numeric > &a, const CustomPoint< numeric > &b)
CustomPoint< numeric > max(const CustomPoint< numeric > &a, const CustomPoint< numeric > &b)