/// \file algorithm/distancepath.h /// \copyright 2022 Sascha Nitsch /// Licenced under MIT license /// \brief declaration of the DistancePath class #ifndef ALGORITHM_DISTANCEPATH_H_ #define ALGORITHM_DISTANCEPATH_H_ // system includes #include // own includes #include "algorithm.h" // forward declaration class Image; namespace Algorithm { /// \brief calculate value based on distance to start point /// for a long description, see README.md class DistancePath : public Algorithm { public: /// \brief constructor /// \param argc number of arguments /// \param argv arguments DistancePath(int argc, const char* argv[]); /// \brief destructor ~DistancePath(); /// \brief process images /// \param input input image /// \param output output image /// \return 0 if ok, != 0 on error int8_t process(Image* input, Image* output); private: /// \brief do actual calculation on pixel /// \param inRAW pointer to raw image input /// \param outRow pointer to current row in output /// \param x x coordinate /// \param y y coordinate /// \param lastValue last value from source pixel /// \param width image width /// \param next list to put new pixel to /// \param outPixels pointer to output pixel array /// \param iteration current iteration number inline void processPixel(uint8_t* inRAW, float* outRow, uint16_t x, uint16_t y, float lastValue, uint16_t width, std::list* next, uint16_t* outPixels, uint16_t iteration); /// \brief do actual calculation on pixel row /// \param inRAW pointer to raw image input /// \param outRAW pointer to output /// \param x x coordinate /// \param y y coordinate /// \param lastValue last value from source pixel /// \param width image width /// \param next list to put new pixel to /// \param outPixels pointer to output pixel array /// \param iteration current iteration number inline void processRow(uint8_t* inRAW, float* outRAW, uint16_t x, uint16_t y, float lastValue, uint16_t width, std::list* next, uint16_t* outPixels, uint16_t iteration); /// weight for pathable neighbour float m_weightPath; /// weight for blocked neighbour float m_weightBlock; /// top cap float m_maxDistance; /// threshhold to mark pixel as traversable in output uint8_t m_threshhold; /// queue of pixels to process std::list m_queue1; }; } // namespace Algorithm #endif // ALGORITHM_DISTANCEPATH_H_