SourceXtractorPlusPlus 1.0.3
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SourceXtractor::ScaledImageSource< T > Class Template Reference

#include <ScaledImageSource.h>

Inheritance diagram for SourceXtractor::ScaledImageSource< T >:
Collaboration diagram for SourceXtractor::ScaledImageSource< T >:

Public Types

enum class  InterpolationType { BILINEAR , BICUBIC }
 Interpolation type: bilinear or bicubic. More...

Public Member Functions

 ScaledImageSource (const std::shared_ptr< Image< T > > &image, int width, int height, InterpolationType interp_type=InterpolationType::BICUBIC)
virtual ~ScaledImageSource ()=default
std::string getRepr () const final
std::shared_ptr< ImageTilegetImageTile (int x, int y, int width, int height) const final
void saveTile (ImageTile &) final
int getWidth () const final
int getHeight () const final
ImageTile::ImageType getType () const override
Public Member Functions inherited from SourceXtractor::ImageSource
 ImageSource ()
virtual ~ImageSource ()=default
virtual const std::map< std::string, MetadataEntry > & getMetadata () const
virtual void setMetadata (const std::string &key, const MetadataEntry &value)

Private Attributes

std::shared_ptr< Image< T > > m_image
int m_width
int m_height
Euclid::MathUtils::InterpolationType m_interpolation_type
std::vector< std::unique_ptr< Euclid::MathUtils::Function > > m_interpolated_cols
std::vector< double > m_x_coords
double m_wscale
double m_hscale

Detailed Description

template<typename T>
class SourceXtractor::ScaledImageSource< T >

Scales an image to a target width and height. Note that the original image grid is centered on the target one, so values on the edges are actually extrapolated.

Template Parameters
TPixel type

Definition at line 35 of file ScaledImageSource.h.

Member Enumeration Documentation

◆ InterpolationType

template<typename T>
enum class SourceXtractor::ScaledImageSource::InterpolationType
strong

Interpolation type: bilinear or bicubic.

Enumerator
BILINEAR 
BICUBIC 

Definition at line 38 of file ScaledImageSource.h.

Constructor & Destructor Documentation

◆ ScaledImageSource()

template<typename T>
SourceXtractor::ScaledImageSource< T >::ScaledImageSource ( const std::shared_ptr< Image< T > > & image,
int width,
int height,
InterpolationType interp_type = InterpolationType::BICUBIC )
inline

Constructor

Parameters
imageImage to upscale
widthNew width
heightNew height
interp_typeInterpolation type

Definition at line 53 of file ScaledImageSource.h.

References BICUBIC, BILINEAR, std::ceil(), std::floor(), SourceXtractor::ImageAccessor< T >::getValue(), Euclid::MathUtils::interpolate(), m_height, m_hscale, m_image, m_interpolated_cols, m_interpolation_type, m_width, m_wscale, m_x_coords, and std::vector< T >::size().

Here is the call graph for this function:

◆ ~ScaledImageSource()

template<typename T>
virtual SourceXtractor::ScaledImageSource< T >::~ScaledImageSource ( )
virtualdefault

Destructor

Member Function Documentation

◆ getHeight()

template<typename T>
int SourceXtractor::ScaledImageSource< T >::getHeight ( ) const
inlinefinalvirtual
Returns
Upscaled height

Implements SourceXtractor::ImageSource.

Definition at line 152 of file ScaledImageSource.h.

References m_height.

◆ getImageTile()

template<typename T>
std::shared_ptr< ImageTile > SourceXtractor::ScaledImageSource< T >::getImageTile ( int x,
int y,
int width,
int height ) const
inlinefinalvirtual

Get a tile from the scaled image

Parameters
xTile offset on the X coordinate
yTile offset on the Y coordinate
widthTile width
heightTile height
Returns
An initialized upscaled tile

Implements SourceXtractor::ImageSource.

Definition at line 118 of file ScaledImageSource.h.

References SourceXtractor::ImageTile::create(), SourceXtractor::ImageTile::getTypeValue(), Euclid::MathUtils::interpolate(), m_interpolated_cols, m_interpolation_type, and m_x_coords.

Here is the call graph for this function:

◆ getRepr()

template<typename T>
std::string SourceXtractor::ScaledImageSource< T >::getRepr ( ) const
inlinefinalvirtual
Returns
Human readable representation of this object

Implements SourceXtractor::ImageSource.

Definition at line 101 of file ScaledImageSource.h.

◆ getType()

template<typename T>
ImageTile::ImageType SourceXtractor::ScaledImageSource< T >::getType ( ) const
inlineoverridevirtual

Implements SourceXtractor::ImageSource.

Definition at line 156 of file ScaledImageSource.h.

References SourceXtractor::ImageTile::getTypeValue().

Here is the call graph for this function:

◆ getWidth()

template<typename T>
int SourceXtractor::ScaledImageSource< T >::getWidth ( ) const
inlinefinalvirtual
Returns
Upscaled width

Implements SourceXtractor::ImageSource.

Definition at line 145 of file ScaledImageSource.h.

References m_width.

◆ saveTile()

template<typename T>
void SourceXtractor::ScaledImageSource< T >::saveTile ( ImageTile & )
inlinefinalvirtual

A tile of this type can not be saved

Implements SourceXtractor::ImageSource.

Definition at line 138 of file ScaledImageSource.h.

Member Data Documentation

◆ m_height

template<typename T>
int SourceXtractor::ScaledImageSource< T >::m_height
private

Definition at line 162 of file ScaledImageSource.h.

Referenced by getHeight(), and ScaledImageSource().

◆ m_hscale

template<typename T>
double SourceXtractor::ScaledImageSource< T >::m_hscale
private

Definition at line 166 of file ScaledImageSource.h.

Referenced by ScaledImageSource().

◆ m_image

template<typename T>
std::shared_ptr<Image<T> > SourceXtractor::ScaledImageSource< T >::m_image
private

Definition at line 161 of file ScaledImageSource.h.

Referenced by ScaledImageSource().

◆ m_interpolated_cols

template<typename T>
std::vector<std::unique_ptr<Euclid::MathUtils::Function> > SourceXtractor::ScaledImageSource< T >::m_interpolated_cols
private

Definition at line 164 of file ScaledImageSource.h.

Referenced by getImageTile(), and ScaledImageSource().

◆ m_interpolation_type

template<typename T>
Euclid::MathUtils::InterpolationType SourceXtractor::ScaledImageSource< T >::m_interpolation_type
private

Definition at line 163 of file ScaledImageSource.h.

Referenced by getImageTile(), and ScaledImageSource().

◆ m_width

template<typename T>
int SourceXtractor::ScaledImageSource< T >::m_width
private

Definition at line 162 of file ScaledImageSource.h.

Referenced by getWidth(), and ScaledImageSource().

◆ m_wscale

template<typename T>
double SourceXtractor::ScaledImageSource< T >::m_wscale
private

Definition at line 166 of file ScaledImageSource.h.

Referenced by ScaledImageSource().

◆ m_x_coords

template<typename T>
std::vector<double> SourceXtractor::ScaledImageSource< T >::m_x_coords
private

Definition at line 165 of file ScaledImageSource.h.

Referenced by getImageTile(), and ScaledImageSource().


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