MythTV  master
CannyEdgeDetector.h
Go to the documentation of this file.
1 /*
2  * CannyEdgeDetector
3  *
4  * Implement the Canny edge detection algorithm.
5  */
6 
7 #ifndef CANNYEDGEDETECTOR_H
8 #define CANNYEDGEDETECTOR_H
9 
10 extern "C" {
11 #include "libavcodec/avcodec.h" /* AVFrame */
12 }
13 #include "EdgeDetector.h"
14 
15 class MythPlayer;
16 
18 {
19 public:
20  CannyEdgeDetector(void);
21  ~CannyEdgeDetector(void) override;
22  CannyEdgeDetector(const CannyEdgeDetector &) = delete; // not copyable
23  CannyEdgeDetector &operator=(const CannyEdgeDetector &) = delete; // not copyable
24  int MythPlayerInited(const MythPlayer *player, int width, int height);
25  int setExcludeArea(int row, int col, int width, int height) override; // EdgeDetector
26  const AVFrame *detectEdges(const AVFrame *pgm, int pgmheight,
27  int percentile) override; // EdgeDetector
28 
29 private:
30  int resetBuffers(int newwidth, int newheight);
31 
32  double *m_mask {nullptr}; /* pre-computed Gaussian mask */
33  int m_maskRadius {2}; /* radius of mask */
34 
35  unsigned int *m_sgm {nullptr}; /* squared-gradient magnitude */
36  unsigned int *m_sgmSorted {nullptr}; /* squared-gradient magnitude */
37  AVFrame m_s1 {}; /* smoothed grayscale frame */
38  AVFrame m_s2 {}; /* smoothed grayscale frame */
39  AVFrame m_convolved {}; /* smoothed grayscale frame */
40  int m_ewidth {-1}; /* dimensions */
41  int m_eheight {-1}; /* dimensions */
42  AVFrame m_edges {}; /* detected edges */
43 
44  struct {
45  int row, col, width, height;
46  } m_exclude {};
47 };
48 
49 #endif /* !CANNYEDGEDETECTOR_H */
50 
51 /* vim: set expandtab tabstop=4 shiftwidth=4: */
CannyEdgeDetector::m_sgmSorted
unsigned int * m_sgmSorted
Definition: CannyEdgeDetector.h:36
CannyEdgeDetector::m_exclude
struct CannyEdgeDetector::@74 m_exclude
CannyEdgeDetector::m_mask
double * m_mask
Definition: CannyEdgeDetector.h:32
CannyEdgeDetector::operator=
CannyEdgeDetector & operator=(const CannyEdgeDetector &)=delete
CannyEdgeDetector::m_s1
AVFrame m_s1
Definition: CannyEdgeDetector.h:37
MythPlayer
Definition: mythplayer.h:165
CannyEdgeDetector::m_s2
AVFrame m_s2
Definition: CannyEdgeDetector.h:38
CannyEdgeDetector::m_maskRadius
int m_maskRadius
Definition: CannyEdgeDetector.h:33
AVFrame
struct AVFrame AVFrame
Definition: BorderDetector.h:15
CannyEdgeDetector::CannyEdgeDetector
CannyEdgeDetector(void)
Definition: CannyEdgeDetector.cpp:19
CannyEdgeDetector::CannyEdgeDetector
CannyEdgeDetector(const CannyEdgeDetector &)=delete
CannyEdgeDetector::m_sgm
unsigned int * m_sgm
Definition: CannyEdgeDetector.h:35
CannyEdgeDetector::m_ewidth
int m_ewidth
Definition: CannyEdgeDetector.h:40
CannyEdgeDetector::m_eheight
int m_eheight
Definition: CannyEdgeDetector.h:41
CannyEdgeDetector::col
int col
Definition: CannyEdgeDetector.h:45
EdgeDetector.h
CannyEdgeDetector
Definition: CannyEdgeDetector.h:18
EdgeDetector
Definition: EdgeDetector.h:28
CannyEdgeDetector::height
int height
Definition: CannyEdgeDetector.h:45
CannyEdgeDetector::resetBuffers
int resetBuffers(int newwidth, int newheight)
Definition: CannyEdgeDetector.cpp:63
CannyEdgeDetector::width
int width
Definition: CannyEdgeDetector.h:45
CannyEdgeDetector::detectEdges
const AVFrame * detectEdges(const AVFrame *pgm, int pgmheight, int percentile) override
Definition: CannyEdgeDetector.cpp:145
CannyEdgeDetector::MythPlayerInited
int MythPlayerInited(const MythPlayer *player, int width, int height)
CannyEdgeDetector::setExcludeArea
int setExcludeArea(int row, int col, int width, int height) override
Definition: CannyEdgeDetector.cpp:135
CannyEdgeDetector::m_convolved
AVFrame m_convolved
Definition: CannyEdgeDetector.h:39
CannyEdgeDetector::m_edges
AVFrame m_edges
Definition: CannyEdgeDetector.h:42
CannyEdgeDetector::row
int row
Definition: CannyEdgeDetector.h:45
CannyEdgeDetector::~CannyEdgeDetector
~CannyEdgeDetector(void) override
Definition: CannyEdgeDetector.cpp:51