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 typedef struct VideoFrame_ VideoFrame;
16 class MythPlayer;
17 
19 {
20 public:
21  CannyEdgeDetector(void);
22  ~CannyEdgeDetector(void);
23  int MythPlayerInited(const MythPlayer *player, int width, int height);
24  int setExcludeArea(int row, int col, int width, int height) override; // EdgeDetector
25  const AVFrame *detectEdges(const AVFrame *pgm, int pgmheight,
26  int percentile) override; // EdgeDetector
27 
28 private:
29  CannyEdgeDetector(const CannyEdgeDetector &) = delete; // not copyable
30  CannyEdgeDetector &operator=(const CannyEdgeDetector &) = delete; // not copyable
31  int resetBuffers(int newwidth, int newheight);
32 
33  double *m_mask {nullptr}; /* pre-computed Gaussian mask */
34  int m_mask_radius {2}; /* radius of mask */
35 
36  unsigned int *m_sgm {nullptr}; /* squared-gradient magnitude */
37  unsigned int *m_sgmsorted {nullptr}; /* squared-gradient magnitude */
38  AVFrame m_s1; /* smoothed grayscale frame */
39  AVFrame m_s2; /* smoothed grayscale frame */
40  AVFrame m_convolved; /* smoothed grayscale frame */
41  int m_ewidth {-1}; /* dimensions */
42  int m_eheight {-1}; /* dimensions */
43  AVFrame m_edges; /* detected edges */
44 
45  struct {
46  int row, col, width, height;
47  } m_exclude;
48 };
49 
50 #endif /* !__CANNYEDGEDETECTOR_H__ */
51 
52 /* vim: set expandtab tabstop=4 shiftwidth=4: */
struct CannyEdgeDetector::@74 m_exclude
struct AVFrame AVFrame
CannyEdgeDetector & operator=(const CannyEdgeDetector &)=delete
int resetBuffers(int newwidth, int newheight)
unsigned int * m_sgm
int setExcludeArea(int row, int col, int width, int height) override
unsigned int * m_sgmsorted
const AVFrame * detectEdges(const AVFrame *pgm, int pgmheight, int percentile) override
int MythPlayerInited(const MythPlayer *player, int width, int height)