SourceXtractorPlusPlus  0.10
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RecenterImage.h
Go to the documentation of this file.
1 
17 /*
18  * @file SEFramework/Image/WarpImage.h
19  * @date 11/09/18
20  * @author Alejandro Alvarez Ayllon
21  */
22 
23 #ifndef _SEFRAMEWORK_IMAGE_WARPIMAGE_H
24 #define _SEFRAMEWORK_IMAGE_WARPIMAGE_H
25 
27 
28 namespace SourceXtractor {
29 
34 template<typename T>
35 class RecenterImage : public ImageBase<T> {
36 protected:
37  RecenterImage(std::shared_ptr<const Image<T>> img, const PixelCoordinate &new_center) : m_img{img},
38  m_center{new_center} {
39  }
40 
41 public:
42  template<typename... Args>
43  static std::shared_ptr<RecenterImage<T>> create(Args &&... args) {
44  return std::shared_ptr<RecenterImage<T>>(new RecenterImage{std::forward<Args>(args)...});
45  }
46 
47  std::string getRepr() const override {
48  return "RecenterImage(" + m_img->getRepr() + ")";
49  }
50 
51  int getWidth() const override {
52  return m_img->getWidth();
53  }
54 
55  int getHeight() const override {
56  return m_img->getHeight();
57  }
58 
59  T getValue(int x, int y) const override {
60  x = (x + m_center.m_x) % m_img->getWidth();
61  y = (y + m_center.m_y) % m_img->getHeight();
62  return m_img->getValue(x, y);
63  }
64 
65 private:
68 };
69 
70 } // end SourceXtractor
71 
72 #endif // _SEFRAMEWORK_IMAGE_WARPIMAGE_H
RecenterImage(std::shared_ptr< const Image< T >> img, const PixelCoordinate &new_center)
Definition: RecenterImage.h:37
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
static std::shared_ptr< RecenterImage< T > > create(Args &&...args)
Definition: RecenterImage.h:43
Changes the center of an image, wrapping it around the edges.
Definition: RecenterImage.h:35
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
STL class.
std::string getRepr() const override
Get a string identifying this image in a human readable manner.
Definition: RecenterImage.h:47
int getWidth() const override
Returns the width of the image in pixels.
Definition: RecenterImage.h:51
A pixel coordinate made of two integers m_x and m_y.
Interface representing an image.
Definition: Image.h:43
int getHeight() const override
Returns the height of the image in pixels.
Definition: RecenterImage.h:55
std::shared_ptr< const Image< T > > m_img
Definition: RecenterImage.h:66
T getValue(int x, int y) const override
Returns the value of the pixel with the coordinates (x,y)
Definition: RecenterImage.h:59