- Home
- Installation
- Using Livekeys
- Plugins
- Developer
group plugin-lcvcore
OpenCV core module wrappers for Livekeys.
Summary
Members | Descriptions |
---|---|
class QMat |
Open cv matrix wrapper. |
class QMatDisplay |
Main matrix display class. |
class QMatFilter |
An abstract filter that transforms an input matrix into it's output. |
class QMatNode |
Node containing matrix state. |
class QMatShader |
Matrix shader. |
class QMatState |
Matrix texture state. |
class QUMat |
Open cv universal matrix wrapper. |
class QWritableMat |
Similar to QMat, but used for quick writeable functions like drawing. |
class QMat
class QMat
: public lv::Shared
Open cv matrix wrapper.
The class represents the wrapper for the opencv matrix element to be passed around in the QML structure. To access it's cv mat value, use the internal() function.
To access it's pixels within qml, use the Mat::buffer() function.
Summary
Members | Descriptions |
---|---|
public explicit QMat (QObject * parent) |
QMat constructor. |
public QMat (cv::Mat * mat,QObject * parent) |
QMat constructor with internal mat. |
public QMat (int width,int height, QMat::Type type,int channels,QObject * parent) |
QMat memory-based constructor. |
public virtual ~QMat () |
QMat::~QMat. |
public QMat * clone () const |
Deep clones the mat. |
public virtual void recycleSize (int size) |
Memory allocation. |
public inline virtual Shared * transfer () |
|
{slot} public QByteArray buffer () const |
Returns an equivalent ArrayBuffer to access the matrix values. |
{slot} public int channels () const |
Returns the number of channels. |
{slot} public int depth () const |
Returns the matrix depth (CV8U, CV16S, ...) |
{slot} public QSize dimensions () const |
Returns the size of the matrix. |
{slot} public QMat * createOwnedObject () |
Returns a shallow copied matrix that is owned by the javascript engine. |
{slot} public QMat * cloneMat () const |
Returns a cloned matrix that is owned by the javascript engine. |
enum Type |
Type of the QMat |
typedef InternalType |
Type. |
Members
public explicit
QMat
(QObject * parent)
QMat constructor.
public
QMat
(cv::Mat * mat,QObject * parent)
QMat constructor with internal mat.
public
QMat
(int width,int height,
QMat::Type
type,int channels,QObject * parent)
QMat memory-based constructor.
Parameters
width
height
type
channels
parent
public virtual
~QMat
()
public
QMat
*
clone
() const
Deep clones the mat.
public virtual void
recycleSize
(int size)
Memory allocation.
public inline virtual Shared *
transfer
()
{slot} public QByteArray
buffer
() const
Returns an equivalent ArrayBuffer to access the matrix values.
{slot} public int
channels
() const
Returns the number of channels.
{slot} public int
depth
() const
Returns the matrix depth (CV8U, CV16S, ...)
{slot} public QSize
dimensions
() const
Returns the size of the matrix.
{slot} public
QMat
*
createOwnedObject
()
Returns a shallow copied matrix that is owned by the javascript engine.
{slot} public
QMat
*
cloneMat
() const
Returns a cloned matrix that is owned by the javascript engine.
enum
Type
Values | Descriptions |
---|---|
CV8U | |
CV8S | |
CV16U | |
CV16S | |
CV32S | |
CV32F | |
CV64F |
Type of the QMat
typedef
InternalType
Type.
class QMatDisplay
class QMatDisplay
: public QQuickItem
Main matrix display class.
Extend this class if you want to have a matrix type item that displays on screen. The display parameter is called output, which you can access by it's setter QMatDisplay::setOutput() and getter QMatDisplay::output().
Within a QML application, if an item is visible, the updatePaintNode() function is called when drawing the element. This can become useful if you have a matrix that requires extra processing only if it will be displayed on screen. when deriving this class, you can override the QMatDisplay::updatePaintNode() function, and implement the actual refurbishing in there. This way, if the element is not visible, you can save some processing time.
Summary
Members | Descriptions |
---|---|
public explicit QMatDisplay (QQuickItem * parent) |
QMatDisplay constructor. |
public QMatDisplay ( QMat * output,QQuickItem * parent) |
QMatDisplay constructor. |
public virtual ~QMatDisplay () |
QMatDisplay destructor. |
public inline QMat * output () |
See also: MatDisplay::output |
public inline bool linearFilter () const |
See also: MatDisplay::linearFilter |
public inline void setLinearFilter (bool filter) |
Setter for linearFilter. |
protected inline void setOutput ( QMat * mat) |
Set the mat to be displayed. |
protected virtual QSGNode * updatePaintNode (QSGNode * node,UpdatePaintNodeData * nodeData) |
Updates the scene graph node with the set matrix. |
{signal} public void outputChanged () |
Triggered when output is changed. |
{signal} public void linearFilterChanged () |
Triggered when linearFilter is changed. |
Members
public explicit
QMatDisplay
(QQuickItem * parent)
QMatDisplay constructor.
Parameters: parent
public
QMatDisplay
(
QMat
* output,QQuickItem * parent)
QMatDisplay constructor.
Parameters: output**parent
public virtual
~QMatDisplay
()
QMatDisplay destructor.
public inline
QMat
*
output
()
See also: MatDisplay::output
public inline bool
linearFilter
() const
See also: MatDisplay::linearFilter
public inline void
setLinearFilter
(bool filter)
Setter for linearFilter.
protected inline void
setOutput
(
QMat
* mat)
Set the mat to be displayed.
protected virtual QSGNode *
updatePaintNode
(QSGNode * node,UpdatePaintNodeData * nodeData)
Updates the scene graph node with the set matrix.
{signal} public void
outputChanged
()
Triggered when output is changed.
{signal} public void
linearFilterChanged
()
Triggered when linearFilter is changed.
class QMatFilter
class QMatFilter
: public QMatDisplay
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 filter :
ImRead{
id : src
file : project.path + '/sample.jpg'
}
MatToGrey{
input : src.output
}
Summary
Members | Descriptions |
---|---|
public explicit QMatFilter (QQuickItem * parent) |
QMatFilter constructor parent. |
public virtual ~QMatFilter () |
QMatFilter destructor. |
public inline QMat * inputMat () |
See also: MatFilter::input |
public inline void setInputMat ( QMat * mat) |
Setter mofr the InputMat. |
public void transform () |
Transformation function that handles notifications and state changes. |
public virtual void transform (const cv::Mat & in,cv::Mat & out) |
Function to be implemented by derived classes to apply the filtering process. in**out. |
protected void componentComplete () |
Function used to initiate the transform function once the component is completed. |
{signal} public void inputChanged () |
Triggered when the input is changed. |
Members
public explicit
QMatFilter
(QQuickItem * parent)
QMatFilter constructor parent.
public virtual
~QMatFilter
()
QMatFilter destructor.
public inline
QMat
*
inputMat
()
See also: MatFilter::input
public inline void
setInputMat
(
QMat
* mat)
Setter mofr the InputMat.
public void
transform
()
Transformation function that handles notifications and state changes.
Call this function in order to trigger the filtering process.
public virtual void
transform
(const cv::Mat & in,cv::Mat & out)
Function to be implemented by derived classes to apply the filtering process. in**out.
protected void
componentComplete
()
Function used to initiate the transform function once the component is completed.
{signal} public void
inputChanged
()
Triggered when the input is changed.
class QMatNode
class QMatNode
: public QSGGeometryNode
Node containing matrix state.
Summary
Members | Descriptions |
---|---|
public QMatNode () |
QMatNode constructor. |
Members
public
QMatNode
()
QMatNode constructor.
class QMatShader
class QMatShader
: public QSGSimpleMaterialShader< QMatState >
Matrix shader.
Summary
Members | Descriptions |
---|---|
public QMatShader () |
QMatShader constructor. |
public inline const char * vertexShader () const |
Returns the vertex shader. |
public inline const char * fragmentShader () const |
Returns the fragment shader. |
public inline QList< QByteArray > attributes () const |
Returns the gl program attributes. |
public inline void updateState (const QMatState * state,const QMatState * oldState) |
Loads the matrixes texture. |
public inline void resolveUniforms () |
Resolves textureId uniform. |
public bool loadTexture ( QMat * mat,int index,bool linearFilter) |
Loads a matrix texture into the gpu program. Returns true on success, false otherwise. |
Members
public
QMatShader
()
QMatShader constructor.
public inline const char *
vertexShader
() const
Returns the vertex shader.
public inline const char *
fragmentShader
() const
Returns the fragment shader.
public inline QList< QByteArray >
attributes
() const
Returns the gl program attributes.
public inline void
updateState
(const
QMatState
* state,const
QMatState
* oldState)
Loads the matrixes texture.
public inline void
resolveUniforms
()
Resolves textureId uniform.
public bool
loadTexture
(
QMat
* mat,int index,bool linearFilter)
Loads a matrix texture into the gpu program. Returns true on success, false otherwise.
class QMatState
Matrix texture state.
Summary
Members | Descriptions |
---|---|
public QMat * mat |
Matrix for which the state is for. |
public bool linearFilter |
Linear filtering flag. |
public mutable int textureIndex |
Stored index of the texture to be displayed. |
public mutable bool textureSync |
Stores wether the texture has been loaded (synced with opengl). |
public QMatState () |
QMatState constructor. |
public int compare (const QMatState * other) const |
Compares 2 states. |
Members
public
QMat
*
mat
Matrix for which the state is for.
public bool
linearFilter
Linear filtering flag.
public mutable int
textureIndex
Stored index of the texture to be displayed.
public mutable bool
textureSync
Stores wether the texture has been loaded (synced with opengl).
public
QMatState
()
QMatState constructor.
public int
compare
(const
QMatState
* other) const
Compares 2 states.
class QUMat
class QUMat
: public lv::Shared
Open cv universal matrix wrapper.
The class represents the wrapper for the opencv matrix element to be passed around in the QML structure. To access it's cv mat value, use the internal() function.
To access it's pixels within qml, use the Mat::buffer() function.
Summary
Members | Descriptions |
---|---|
public explicit QUMat (QObject * parent) |
QUMat constructor. |
public QUMat (cv::UMat * mat,QObject * parent) |
QUMat constructor with internal mat. |
public QUMat (int width,int height, QUMat::Type type,int channels,QObject * parent) |
QUMat memory-based constructor. |
public virtual ~QUMat () |
QUMat::~QUMat. |
public QUMat * clone () const |
Deep clones the mat. |
public virtual void recycleSize (int size) |
Memory allocation. |
public inline virtual Shared * transfer () |
|
{slot} public int channels () const |
Returns the number of channels. |
{slot} public int depth () const |
Returns the matrix depth (CV8U, CV16S, ...) |
{slot} public QSize dimensions () const |
Returns the size of the matrix. |
{slot} public QUMat * createOwnedObject () |
Returns a shallow copied matrix that is owned by the javascript engine. |
{slot} public QUMat * cloneMat () const |
Returns a cloned matrix that is owned by the javascript engine. |
{slot} public QMat * getMat () const |
|
enum Type |
Type of the QUMat |
typedef InternalType |
Type. |
Members
public explicit
QUMat
(QObject * parent)
QUMat constructor.
public
QUMat
(cv::UMat * mat,QObject * parent)
QUMat constructor with internal mat.
public
QUMat
(int width,int height,
QUMat::Type
type,int channels,QObject * parent)
QUMat memory-based constructor.
Parameters
width
height
type
channels
parent
public virtual
~QUMat
()
public
QUMat
*
clone
() const
Deep clones the mat.
public virtual void
recycleSize
(int size)
Memory allocation.
public inline virtual Shared *
transfer
()
{slot} public int
channels
() const
Returns the number of channels.
{slot} public int
depth
() const
Returns the matrix depth (CV8U, CV16S, ...)
{slot} public QSize
dimensions
() const
Returns the size of the matrix.
{slot} public
QUMat
*
createOwnedObject
()
Returns a shallow copied matrix that is owned by the javascript engine.
{slot} public
QUMat
*
cloneMat
() const
Returns a cloned matrix that is owned by the javascript engine.
{slot} public
QMat
*
getMat
() const
enum
Type
Values | Descriptions |
---|---|
CV8U | |
CV8S | |
CV16U | |
CV16S | |
CV32S | |
CV32F | |
CV64F |
Type of the QUMat
typedef
InternalType
Type.
class QWritableMat
class QWritableMat
: public QObject
Similar to QMat, but used for quick writeable functions like drawing.
This class will mostly used to preserve QMat's immutability accross functions.
To convert to a QMat, use:
QMat* m = writableMat.toMat();
Summary
Members | Descriptions |
---|---|
public explicit QWritableMat (QObject * parent) |
QWritableMat constructor. |
public QWritableMat (cv::Mat * mat,QObject * parent) |
QWritableMat constructor with internal mat. |
public virtual ~QWritableMat () |
QWritableMat destructor. |
{slot} public QByteArray buffer () |
Returns an equivalent ArrayBuffer to access the matrix values. |
{slot} public int channels () const |
Returns the number of channels. |
{slot} public int depth () const |
Returns the matrix depth (CV8U, CV16S, ...) |
{slot} public QSize dimensions () const |
Returns the size of the matrix. |
{slot} public QMat * toMat () const |
Returns copied QMat of this object. |
{slot} public void fill (const QColor & color, QMat * mask) |
Fills the matrix with a specified color. |
Members
public explicit
QWritableMat
(QObject * parent)
QWritableMat constructor.
public
QWritableMat
(cv::Mat * mat,QObject * parent)
QWritableMat constructor with internal mat.
public virtual
~QWritableMat
()
QWritableMat destructor.
{slot} public QByteArray
buffer
()
Returns an equivalent ArrayBuffer to access the matrix values.
{slot} public int
channels
() const
Returns the number of channels.
{slot} public int
depth
() const
Returns the matrix depth (CV8U, CV16S, ...)
{slot} public QSize
dimensions
() const
Returns the size of the matrix.
{slot} public
QMat
*
toMat
() const
Returns copied QMat of this object.
{slot} public void
fill
(const QColor & color,
QMat
* mask)
Fills the matrix with a specified color.