| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <array> | ||
| 4 | #include <cstdint> | ||
| 5 | #include <vector> | ||
| 6 | |||
| 7 | #include "badanov_a_select_edge_sobel/common/include/common.hpp" | ||
| 8 | #include "task/include/task.hpp" | ||
| 9 | |||
| 10 | namespace badanov_a_select_edge_sobel { | ||
| 11 | |||
| 12 | ✗ | class BadanovASelectEdgeSobelOMP : public BaseTask { | |
| 13 | public: | ||
| 14 | static constexpr ppc::task::TypeOfTask GetStaticTypeOfTask() { | ||
| 15 | return ppc::task::TypeOfTask::kOMP; | ||
| 16 | } | ||
| 17 | explicit BadanovASelectEdgeSobelOMP(const InType &in); | ||
| 18 | |||
| 19 | private: | ||
| 20 | bool ValidationImpl() override; | ||
| 21 | bool PreProcessingImpl() override; | ||
| 22 | bool RunImpl() override; | ||
| 23 | bool PostProcessingImpl() override; | ||
| 24 | |||
| 25 | void ApplySobelOperator(const std::vector<uint8_t> &input, std::vector<float> &magnitude, float &max_magnitude); | ||
| 26 | void ComputeGradientAtPixel(const std::vector<uint8_t> &input, int row, int col, float &gradient_x, | ||
| 27 | float &gradient_y) const; | ||
| 28 | void ApplyThreshold(const std::vector<float> &magnitude, float max_magnitude, std::vector<uint8_t> &output) const; | ||
| 29 | |||
| 30 | static constexpr std::array<std::array<int, 3>, 3> kKernelX = {{{{-1, 0, 1}}, {{-2, 0, 2}}, {{-1, 0, 1}}}}; | ||
| 31 | |||
| 32 | static constexpr std::array<std::array<int, 3>, 3> kKernelY = {{{{-1, -2, -1}}, {{0, 0, 0}}, {{1, 2, 1}}}}; | ||
| 33 | |||
| 34 | int width_ = 0; | ||
| 35 | int height_ = 0; | ||
| 36 | int threshold_ = 50; | ||
| 37 | }; | ||
| 38 | |||
| 39 | } // namespace badanov_a_select_edge_sobel | ||
| 40 |