QMatFilter Class

An abstract filter that transforms an input matrix into it's output. More...

Header: #include <QMatFilter>
Instantiated By: MatFilter
Inherits: QMatDisplay
Inherited By:

QBackgroundSubtractor

Properties

Public Functions

QMatFilter(QQuickItem *parent = 0)
virtual ~QMatFilter()
QMat *inputMat()
void setInputMat(QMat *mat)
void transform()
virtual void transform(const cv::Mat &in, cv::Mat &out)

Signals

void inputChanged()

Protected Functions

Detailed Description

An abstract filter that transforms an input matrix into it's output.

Besides the QMatDisplay class it inherits, the QMatFilter adds an input element, and a transformation function to further ease implementing filters. The transformation function gets called every time the input element is changed. This means that to write a simple filter, all you have to do is extend this class and implement the transformation function. Here's a small example of a filter that transforms a BGR image into grayscale :

class QMatToGrey : public QMatFilter{

    Q_OBJECT

public:
    QMatToGrey(QQuickItem* parent = 0):QMatFilter(parent){
    }

    void transform(const cv::Mat& in, cv::Mat& out){
        cvtColor(in, out, CV_BGR2GREY);
    }

}

With that all that's left is to register the element to QML, after which you can use it like any other Live CV filter :

ImRead{
     id : src
     file : project.path + '/sample.jpg'
}
MatToGrey{
     input : src.output
}

Property Documentation

input : QMat *

Access functions:

QMat *inputMat()
void setInputMat(QMat *mat)

Notifier signal:

void inputChanged()

See also MatFilter::input.

Member Function Documentation

QMatFilter::QMatFilter(QQuickItem *parent = 0)

QMatFilter constructor parent

[virtual] QMatFilter::~QMatFilter()

QMatFilter destructor

[protected] void QMatFilter::componentComplete()

Function used to initiate the transform function once the component is completed.

void QMatFilter::transform()

Transformation function that handles notifications and state changes.

Call this function in order to trigger the filtering process.

[virtual] void QMatFilter::transform(const cv::Mat &in, cv::Mat &out)

Function to be implemented by derived classes to apply the filtering process. in out