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(void) override
unsigned int * m_sgmSorted
CannyEdgeDetector & operator=(const CannyEdgeDetector &)=delete
struct AVFrame AVFrame
int resetBuffers(int newwidth, int newheight)
unsigned int * m_sgm
int setExcludeArea(int row, int col, int width, int height) override
const AVFrame * detectEdges(const AVFrame *pgm, int pgmheight, int percentile) override
int MythPlayerInited(const MythPlayer *player, int width, int height)
struct CannyEdgeDetector::@71 m_exclude