Webcam Tracker  V1.0
Using openCV and an Arduino Uno
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members

Child-classe, implements OpenCV's GaussianBlur. More...

#include <Blur.h>

Inheritance diagram for Blur:

Public Member Functions

 Blur (const cv::String name)
 Constructor. More...
 
void setAction (void *data)
 sets the output of the action More...
 
void showWindow ()
 shows the action to the user More...
 
- Public Member Functions inherited from PipeLineAction
 PipeLineAction ()
 Default constructor.
 
 PipeLineAction (const cv::String name)
 Constructor. More...
 
virtual void * getAction ()
 gets the output of the action More...
 
void hideWindow ()
 hides the action to the user More...
 
cv::String getName ()
 gets the pipeline action name More...
 

Static Public Member Functions

static void onChange (int, void *data)
 Handles the change trackbar event. More...
 

Private Attributes

const int maxValue = 20
 maximum value of the associated trackbar
 
int slider
 current value of the associated trackba
 
float sigma
 Gaussian kernel standard deviation in X and Y direction.
 
int kernelSize
 Gaussian kernel size in X and Y direction.
 

Additional Inherited Members

- Protected Attributes inherited from PipeLineAction
cv::Mat img
 Matrix which holds the image of the action.
 
bool show
 Show action flag.
 
cv::String name
 (screen)name of the pipeline action
 

Detailed Description

Child-classe, implements OpenCV's GaussianBlur.

Constructor & Destructor Documentation

◆ Blur()

Blur::Blur ( const cv::String  name)

Constructor.

Parameters
name(screen)name of blur action
15 {
16  slider = 3;
17  kernelSize = 2 * slider + 1;
18  sigma = 0.3 * ((static_cast<float>(kernelSize) - 1) * 0.5 - 1) + 0.8;
19 }
int slider
current value of the associated trackba
Definition: Blur.h:18
int kernelSize
Gaussian kernel size in X and Y direction.
Definition: Blur.h:20
float sigma
Gaussian kernel standard deviation in X and Y direction.
Definition: Blur.h:19
cv::String name
(screen)name of the pipeline action
Definition: PipeLineAction.h:27
PipeLineAction()
Default constructor.
Definition: PipeLineAction.cpp:11

Member Function Documentation

◆ setAction()

void Blur::setAction ( void *  data)
virtual

sets the output of the action

in this case: bluring the input. The blursize is based on the trackbar value.

Parameters
datapointer to the input data, should be a OpenCV matrix

Implements PipeLineAction.

22 {
23  Mat* d = static_cast<Mat*>(data);
24  GaussianBlur(*d, img, Size(kernelSize, kernelSize), sigma);
25 }
cv::Mat img
Matrix which holds the image of the action.
Definition: PipeLineAction.h:25

◆ showWindow()

void Blur::showWindow ( )
virtual

shows the action to the user

uses cv::imshow(). The name of the window is the name of the pipeline action. Trackbar is added to set the size of the Gaussion blur

Implements PipeLineAction.

28 {
29  if (!show) {
30  namedWindow(name);
31  createTrackbar("Factor", name, &slider, maxValue, onChange, this);
32  show = true;
33  }
34  imshow(name, img);
35 }
static void onChange(int, void *data)
Handles the change trackbar event.
Definition: Blur.cpp:37
const int maxValue
maximum value of the associated trackbar
Definition: Blur.h:17
bool show
Show action flag.
Definition: PipeLineAction.h:26
Here is the call graph for this function:

◆ onChange()

void Blur::onChange ( int  ,
void *  data 
)
static

Handles the change trackbar event.

updates the kernelSize based on the trackbar position

Parameters
datapointer to the blur object associated with the trackbar
38 {
39  Blur* b = static_cast<Blur*>(data);
40  if (b) {
41  b->kernelSize = 2 * b->slider + 1;
42  b->sigma = 0.3 * ((static_cast<float>(b->kernelSize) - 1) * 0.5 - 1) + 0.8;
43  }
44 }
Child-classe, implements OpenCV's GaussianBlur.
Definition: Blur.h:14
Here is the caller graph for this function: