Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial commit

Signed-off-by: coffeesmoke <vladimir.litvinenko@codepaint.ru>

Signed-off-by: coffeesmoke <vladimir.litvinenko@codepaint.ru>
  • Loading branch information...
commit bff7aed2d5b630e3c9aee461b597e57ccfda0d0e 1 parent edb9726
@coffeesmoke authored
Showing with 3,594 additions and 0 deletions.
  1. +6 −0 QtOpenCVWidgets/QtOpenCVWidgets.pro
  2. +20 −0 QtOpenCVWidgets/examples/OpenCVAviVideo/OpenCVAviVideo.pro
  3. +25 −0 QtOpenCVWidgets/examples/OpenCVAviVideo/main.cpp
  4. +9 −0 QtOpenCVWidgets/examples/examples.pro
  5. +40 −0 QtOpenCVWidgets/examples/testCaptureRuntime/main.cpp
  6. +174 −0 QtOpenCVWidgets/examples/testCaptureRuntime/mainwindow.cpp
  7. +74 −0 QtOpenCVWidgets/examples/testCaptureRuntime/mainwindow.h
  8. +454 −0 QtOpenCVWidgets/examples/testCaptureRuntime/mainwindow.ui
  9. +45 −0 QtOpenCVWidgets/examples/testCaptureRuntime/testCaptureRuntime.pro
  10. +38 −0 QtOpenCVWidgets/examples/testCaptureWidget/main.cpp
  11. +82 −0 QtOpenCVWidgets/examples/testCaptureWidget/mainwindow.cpp
  12. +60 −0 QtOpenCVWidgets/examples/testCaptureWidget/mainwindow.h
  13. +188 −0 QtOpenCVWidgets/examples/testCaptureWidget/mainwindow.ui
  14. +34 −0 QtOpenCVWidgets/examples/testCaptureWidget/testCaptureWidget.pro
  15. +81 −0 QtOpenCVWidgets/include/qtopencv_global.h
  16. BIN  QtOpenCVWidgets/qtdesigner/QtOpenCVLogo.png
  17. +4 −0 QtOpenCVWidgets/qtdesigner/cqtopencvcapturewidget.pri
  18. +109 −0 QtOpenCVWidgets/qtdesigner/cqtopencvcapturewidgetplugin.cpp
  19. +64 −0 QtOpenCVWidgets/qtdesigner/cqtopencvcapturewidgetplugin.h
  20. +47 −0 QtOpenCVWidgets/qtdesigner/cqtopencvcollection.cpp
  21. +48 −0 QtOpenCVWidgets/qtdesigner/cqtopencvcollection.h
  22. +6 −0 QtOpenCVWidgets/qtdesigner/icons.qrc
  23. +28 −0 QtOpenCVWidgets/qtdesigner/qtdesigner.pro
  24. +54 −0 QtOpenCVWidgets/runtime/capture/QtOpenCVCapture/QtOpenCVCapture.pro
  25. +808 −0 QtOpenCVWidgets/runtime/capture/QtOpenCVCapture/cqtopencvcaptureobject.cpp
  26. +170 −0 QtOpenCVWidgets/runtime/capture/QtOpenCVCapture/cqtopencvcaptureobject.h
  27. +4 −0 QtOpenCVWidgets/runtime/capture/capture.pro
  28. +6 −0 QtOpenCVWidgets/runtime/runtime.pro
  29. +46 −0 QtOpenCVWidgets/widgets/QtOpenCVCaptureWidget/QtOpenCVCaptureWidget.pro
  30. +634 −0 QtOpenCVWidgets/widgets/QtOpenCVCaptureWidget/cqtopencvcapturewidget.cpp
  31. +232 −0 QtOpenCVWidgets/widgets/QtOpenCVCaptureWidget/cqtopencvcapturewidget.h
  32. +4 −0 QtOpenCVWidgets/widgets/widgets.pro
View
6 QtOpenCVWidgets/QtOpenCVWidgets.pro
@@ -0,0 +1,6 @@
+TEMPLATE=subdirs
+SUBDIRS=runtime \
+# images \
+ examples \
+ widgets \
+ qtdesigner
View
20 QtOpenCVWidgets/examples/OpenCVAviVideo/OpenCVAviVideo.pro
@@ -0,0 +1,20 @@
+TEMPLATE = app
+CONFIG += console
+#CONFIG -= qt
+CONFIG += core
+
+SOURCES += main.cpp
+
+#win32:CONFIG(release, debug|release): LIBS += -L/usr/lib/release/ -lopencv_highgui
+#else:win32:CONFIG(debug, debug|release): LIBS += -L/usr/lib/debug/ -lopencv_highgui
+#else:symbian: LIBS += -lopencv_highgui
+#else:
+unix: LIBS += -L/usr/lib/ -lopencv_highgui
+
+INCLUDEPATH += /usr/include/opencv2/highgui
+DEPENDPATH += /usr/include/opencv2/highgui
+
+unix: LIBS += -L/usr/lib/ -lopencv_core
+
+INCLUDEPATH += /usr/include/opencv2/core
+DEPENDPATH += /usr/include/opencv2/core
View
25 QtOpenCVWidgets/examples/OpenCVAviVideo/main.cpp
@@ -0,0 +1,25 @@
+#include <opencv2/opencv.hpp>
+#include <opencv2/highgui/highgui.hpp>
+#include <QString>
+#include <stdio.h>
+
+int main()
+{
+ cvNamedWindow ("Example2", CV_WINDOW_AUTOSIZE );
+ QString path = QString::fromLatin1 ("/home/developer/Видео/IceAge3.avi");
+ printf("path = %s\n", path.toStdString ().c_str ());
+ CvCapture* capture = cvCreateFileCapture (path.toStdString ().c_str ());
+ IplImage* frame; // Здесь будет кадр
+
+ while(1) {
+ frame = cvQueryFrame( capture ); // Читаем кадр из файла
+ if( !frame ) break; // Если кадров больше нет - выходим
+ cvShowImage ("Example2", frame ); // Выводим кадр
+ char c = (char)cvWaitKey (33); // Ждем 33мс
+ if( c == 27 ) break; // Если нажали Esc - выходим
+ }
+ cvReleaseCapture( &capture ); // Закрываем файл
+ cvDestroyWindow( "Example2" );
+ return (0);
+}
+
View
9 QtOpenCVWidgets/examples/examples.pro
@@ -0,0 +1,9 @@
+TEMPLATE = subdirs
+#SUBDIRS = testOpenCVImage \
+# testOpenCVCanny \
+# testPureOpenCVCapture
+SUBDIRS = \
+# app4UIModeling \
+ testCaptureRuntime \
+ testCaptureWidget \
+ OpenCVAviVideo
View
40 QtOpenCVWidgets/examples/testCaptureRuntime/main.cpp
@@ -0,0 +1,40 @@
+/*
+Copyright (c) 2012, Vladimir N. Litvinenko
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include <QtGui/QApplication>
+#include "mainwindow.h"
+
+/*----------------------------------------------------------------------------*/
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ MainWindow w;
+
+ w.show();
+
+ return a.exec();
+}
View
174 QtOpenCVWidgets/examples/testCaptureRuntime/mainwindow.cpp
@@ -0,0 +1,174 @@
+/*
+Copyright (c) 2012, Vladimir N. Litvinenko
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+#include <stdio.h>
+
+MainWindow::MainWindow(QWidget *parent) :
+ QMainWindow(parent),
+ ui(new Ui::MainWindow),
+ p_capture(new CQtOpenCVCaptureObject(this)),
+ p_c(NULL),
+ p_i(NULL)
+{
+ s_tmp.clear ();
+
+ ui->setupUi(this);
+
+ ui->p_label_ErrMsg->setText (QString::fromUtf8 ("отсутствует."));
+
+ p_capture->slot_captureOn (false);
+ p_capture->slot_Activate (false);
+ ui->p_radioButton_Number->setChecked (true);
+
+ on_p_radioButton_Number_toggled (true);
+
+ cvNamedWindow("Image");
+
+ connect (p_capture, SIGNAL(signal_ImageChanged(const IplImage*)), this, SLOT(slot_GetImage(const IplImage*)) );
+ connect (p_capture, SIGNAL(signal_CaptureChanged(const CvCapture*)), this, SLOT(slot_GetCapture(const CvCapture*)) );
+ connect (p_capture, SIGNAL(signal_ActiveChanged(bool)), this, SLOT(slot_ActiveChanged(bool)) );
+ connect (p_capture, SIGNAL(signal_Errno(int,QString)), this, SLOT(slot_Errno(int,QString)) );
+}
+
+MainWindow::~MainWindow()
+{
+ cvDestroyAllWindows ();
+ p_capture->slot_captureOn (false);
+ delete ui;
+}
+
+void MainWindow::changeEvent(QEvent *e)
+{
+ QMainWindow::changeEvent(e);
+ switch (e->type()) {
+ case QEvent::LanguageChange:
+ ui->retranslateUi(this);
+ break;
+ default:
+ break;
+ }
+}
+
+void
+MainWindow::slot_ActiveChanged( bool value )
+{
+ ui->p_pushButton_Activate->setChecked (value);
+}
+
+void MainWindow::slot_GetCapture(const CvCapture* value)
+{
+ ui->p_pushButton_On->setChecked (value != NULL);
+ if(value == NULL) {
+ ui->p_label_CaptureAddr->setText("NULL");
+ } else {
+ int i = *((int*)(&value));
+ ui->p_label_CaptureAddr->setText(QString("0x") + QString::number (i, 16)+QString("h"));
+ }
+}
+
+void MainWindow::slot_GetImage(const IplImage* value)
+{
+ if(value == NULL) {
+ ui->p_label_ImageAddr->setText("NULL");
+ } else {
+ int i = *((int*)(&value));
+ ui->p_label_ImageAddr->setText(QString("0x") + QString::number (i, 16)+QString("h"));
+ cvShowImage("Image", value);
+ }
+}
+
+void
+MainWindow::slot_Errno(int errno, const QString& errmsg)
+{
+ if(errmsg.isEmpty ())
+ ui->p_label_ErrMsg->setText ("");
+ else
+ ui->p_label_ErrMsg->setText (QString::fromUtf8 ("Номер= ")+QString::number (errno)+ " ("+errmsg+")");
+}
+
+void MainWindow::on_p_radioButton_URL_toggled(bool checked)
+{
+ ui->p_label_PathNum->setText (QString::fromUtf8 ("Файл или URL:"));
+ ui->p_lineEdit->setVisible (checked);
+ ui->p_spinBox_Number->setVisible (!checked);
+ p_capture->slot_SetAsInternal (!checked);
+}
+
+void MainWindow::on_p_radioButton_Number_toggled(bool checked)
+{
+ ui->p_label_PathNum->setText (QString::fromUtf8 ("Номер вебкамеры:"));
+ ui->p_lineEdit->setVisible (!checked);
+ ui->p_spinBox_Number->setVisible (checked);
+ p_capture->slot_SetAsInternal (checked);
+}
+
+void MainWindow::on_p_spinBox_Number_valueChanged(int arg1)
+{
+ p_capture->slot_SetNumber (arg1);
+}
+
+void MainWindow::on_p_spinBox_TOut_valueChanged(int arg1)
+{
+ p_capture->slot_SetTimeout (arg1);
+}
+
+void MainWindow::on_p_checkBox_Recap_toggled(bool checked)
+{
+ slot_Errno (0,"");
+ p_capture->slot_SetRecap (checked);
+}
+
+void MainWindow::on_p_lineEdit_returnPressed()
+{
+ p_capture->slot_SetPath (s_tmp);
+}
+
+void MainWindow::on_p_lineEdit_textChanged(const QString &arg1)
+{
+ s_tmp = arg1;
+}
+
+void MainWindow::on_p_pushButton_On_toggled(bool checked)
+{
+ slot_Errno (0,"");
+ p_capture->slot_captureOn (checked);
+}
+
+void MainWindow::on_p_pushButton_Activate_toggled(bool checked)
+{
+ slot_Errno (0,"");
+ p_capture->slot_Activate (checked);
+}
+
+void MainWindow::on_p_pushButton_Test_toggled(bool checked)
+{
+ slot_Errno (0,"");
+ ui->p_pushButton_On->setChecked (checked);
+ ui->p_pushButton_Activate->setChecked (checked);
+}
View
74 QtOpenCVWidgets/examples/testCaptureRuntime/mainwindow.h
@@ -0,0 +1,74 @@
+/*
+Copyright (c) 2012, Vladimir N. Litvinenko
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+#include "../../runtime/capture/QtOpenCVCapture/cqtopencvcaptureobject.h"
+
+namespace Ui {
+class MainWindow;
+}
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+ public:
+ explicit MainWindow(QWidget *parent = 0);
+ ~MainWindow();
+
+ protected:
+ void changeEvent(QEvent *e);
+
+ private Q_SLOTS:
+ void slot_Errno(int, const QString& );
+ void slot_GetCapture(const CvCapture*);
+ void slot_GetImage(const IplImage*);
+ void slot_ActiveChanged( bool );
+
+ void on_p_radioButton_URL_toggled(bool checked);
+ void on_p_radioButton_Number_toggled(bool checked);
+ void on_p_spinBox_Number_valueChanged(int arg1);
+ void on_p_spinBox_TOut_valueChanged(int arg1);
+ void on_p_checkBox_Recap_toggled(bool checked);
+ void on_p_lineEdit_returnPressed();
+ void on_p_lineEdit_textChanged(const QString &arg1);
+ void on_p_pushButton_On_toggled(bool checked);
+ void on_p_pushButton_Activate_toggled(bool checked);
+ void on_p_pushButton_Test_toggled(bool checked);
+
+ private:
+ Ui::MainWindow *ui;
+ CQtOpenCVCaptureObject* p_capture;
+ CvCapture* p_c;
+ IplImage* p_i;
+ QString s_tmp;
+};
+
+#endif // MAINWINDOW_H
View
454 QtOpenCVWidgets/examples/testCaptureRuntime/mainwindow.ui
@@ -0,0 +1,454 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>540</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>540</width>
+ <height>300</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>540</width>
+ <height>300</height>
+ </size>
+ </property>
+ <property name="windowTitle">
+ <string>Тест класса &quot;СQtOpenCVCaptureObject&quot;</string>
+ </property>
+ <widget class="QWidget" name="centralwidget">
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="0" column="0">
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
+ <widget class="QGroupBox" name="p_groupBox_Capture">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>520</width>
+ <height>165</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>520</width>
+ <height>165</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>Устройство видеозахвата</string>
+ </property>
+ <property name="flat">
+ <bool>true</bool>
+ </property>
+ <layout class="QGridLayout" name="p_gridLayout_GBox">
+ <property name="margin">
+ <number>3</number>
+ </property>
+ <property name="spacing">
+ <number>1</number>
+ </property>
+ <item row="0" column="0">
+ <layout class="QHBoxLayout" name="p_horLayout_Radio">
+ <property name="spacing">
+ <number>1</number>
+ </property>
+ <item>
+ <widget class="QRadioButton" name="p_radioButton_URL">
+ <property name="text">
+ <string>Адрес в сети</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="p_radioButton_Number">
+ <property name="text">
+ <string>Номер вебкамеры</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <layout class="QHBoxLayout" name="p_horLayout_PathNum">
+ <property name="spacing">
+ <number>3</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="p_label_PathNum">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>150</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text">
+ <string>Файл</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+ </property>
+ <property name="buddy">
+ <cstring>p_lineEdit</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="p_spinBox_Number">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimum">
+ <number>0</number>
+ </property>
+ <property name="maximum">
+ <number>999999</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="p_lineEdit">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="0">
+ <layout class="QHBoxLayout" name="p_horLayout_TOut">
+ <property name="spacing">
+ <number>3</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="p_label_TOut">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>150</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Интервал опроса:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="p_spinBox_TOut">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimum">
+ <number>0</number>
+ </property>
+ <property name="maximum">
+ <number>999999</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="p_label_ms">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>мс</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="p_horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Preferred</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item row="3" column="0">
+ <layout class="QHBoxLayout" name="p_horLayout_Buttons">
+ <property name="spacing">
+ <number>3</number>
+ </property>
+ <item>
+ <widget class="QCheckBox" name="p_checkBox_Recap">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Перезахват по таймауту</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="p_pushButton_Test">
+ <property name="text">
+ <string>Проверка</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="p_pushButton_On">
+ <property name="text">
+ <string>Включить</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="p_pushButton_Activate">
+ <property name="text">
+ <string>Запуск</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ <property name="default">
+ <bool>false</bool>
+ </property>
+ <property name="flat">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <layout class="QVBoxLayout" name="p_verticalLayout_Info">
+ <item>
+ <layout class="QHBoxLayout" name="p_horizontalLayout_Capture">
+ <item>
+ <widget class="QLabel" name="p_label_Capture">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Адрес &lt;span style=&quot; font-weight:600;&quot;&gt;CvCapture&lt;/span&gt; в памяти&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="p_label_CaptureAddr">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="p_horizontalLayout_Image">
+ <item>
+ <widget class="QLabel" name="p_label_Image">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Адрес &lt;span style=&quot; font-weight:600;&quot;&gt;IplImage&lt;/span&gt; в памяти&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="p_label_ImageAddr">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="p_horizontalLayout_Image_2">
+ <item>
+ <widget class="QLabel" name="p_label_Errno">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Ошибка: </string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="p_label_ErrMsg">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="p_verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="menubar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>540</width>
+ <height>24</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menu">
+ <property name="title">
+ <string>&amp;Файл</string>
+ </property>
+ <addaction name="action"/>
+ </widget>
+ <addaction name="menu"/>
+ </widget>
+ <action name="action">
+ <property name="text">
+ <string>Выход</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+Q</string>
+ </property>
+ </action>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>action</sender>
+ <signal>activated()</signal>
+ <receiver>MainWindow</receiver>
+ <slot>close()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>-1</x>
+ <y>-1</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>284</x>
+ <y>70</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
View
45 QtOpenCVWidgets/examples/testCaptureRuntime/testCaptureRuntime.pro
@@ -0,0 +1,45 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2012-06-22T12:51:27
+#
+#-------------------------------------------------
+
+QT += core gui
+
+TARGET = testCaptureRuntime
+CONFIG += console debug
+CONFIG -= app_bundle
+
+TEMPLATE = app
+
+
+HEADERS += \
+ mainwindow.h
+
+SOURCES += main.cpp \
+ mainwindow.cpp
+
+#win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../../../../usr/lib/release/ -lQtOpenCVCapture
+#else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../../../../usr/lib/debug/ -lQtOpenCVCapture
+#else:symbian: LIBS += -lQtOpenCVCapture
+#else:
+unix: LIBS += -L/usr/lib/ -lQtOpenCVCapture
+
+#win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../../../../usr/lib/release/ -lopencv_core
+#else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../../../../usr/lib/debug/ -lopencv_core
+#else:symbian: LIBS += -lopencv_core
+#else:
+unix: LIBS += -L/usr/lib/ -lopencv_core
+unix: LIBS += -L/usr/lib/ -lopencv_highgui
+
+INCLUDEPATH += /usr/include \
+ /usr/include/opencv2/core \
+ /usr/include/opencv2/highgui \
+ $$PWD/../../runtime/capture/QtOpenCVCapture
+DEPENDPATH += /usr/include \
+ /usr/include/opencv2/core \
+ /usr/include/opencv2/highgui \
+ $$PWD/../../runtime/capture/QtOpenCVCapture
+
+FORMS += \
+ mainwindow.ui
View
38 QtOpenCVWidgets/examples/testCaptureWidget/main.cpp
@@ -0,0 +1,38 @@
+/*
+Copyright (c) 2012, Vladimir N. Litvinenko
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include <QtGui/QApplication>
+#include "mainwindow.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ MainWindow w;
+ w.show();
+
+ return a.exec();
+}
View
82 QtOpenCVWidgets/examples/testCaptureWidget/mainwindow.cpp
@@ -0,0 +1,82 @@
+/*
+Copyright (c) 2012, Vladimir N. Litvinenko
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+#include <stdio.h>
+#include <opencv2/highgui/highgui.hpp>
+
+MainWindow::MainWindow(QWidget *parent) :
+ QMainWindow(parent),
+ ui(new Ui::MainWindow)
+{
+ ui->setupUi(this);
+ cvNamedWindow ("Image", CV_WINDOW_NORMAL);
+
+ connect (ui->cQtOpenCVCaptureWidget, SIGNAL(signal_CaptureChanged(const CvCapture*)),this,SLOT(slot_GetCapture(const CvCapture*)));
+ connect (ui->cQtOpenCVCaptureWidget, SIGNAL(signal_ImageChanged(const IplImage*)),this,SLOT(slot_GetImage(const IplImage*)));
+ connect (ui->cQtOpenCVCaptureWidget, SIGNAL(signal_Errno(int,QString)), this, SLOT(slot_Errno(int,QString)));
+}
+
+MainWindow::~MainWindow()
+{
+ ui->cQtOpenCVCaptureWidget->slot_captureOn (false);
+ delete ui;
+ cvDestroyAllWindows ();
+}
+
+void MainWindow::changeEvent(QEvent *e)
+{
+ QMainWindow::changeEvent(e);
+ switch (e->type()) {
+ case QEvent::LanguageChange:
+ ui->retranslateUi(this);
+ break;
+ default:
+ break;
+ }
+}
+
+void MainWindow::slot_GetCapture(const CvCapture* value)
+{
+ int i = *((int*)(&value));
+ ui->label_CaptureAddr->setText(QString("0x") + QString::number (i, 16)+QString("h"));
+}
+
+void MainWindow::slot_GetImage(const IplImage* value)
+{
+ int i = *((int*)(&value));
+ ui->label_ImageAddr->setText(QString("0x") + QString::number (i, 16)+QString("h"));
+ if(value) cvShowImage ("Image", value);
+}
+
+void
+MainWindow::slot_Errno(int errno, const QString& errmsg)
+{
+// printf("Errno %d: %s\n", errno, QString(errmsg.toLocal8Bit ()).toStdString ().c_str ());
+}
+
View
60 QtOpenCVWidgets/examples/testCaptureWidget/mainwindow.h
@@ -0,0 +1,60 @@
+/*
+Copyright (c) 2012, Vladimir N. Litvinenko
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+#include "../../widgets/QtOpenCVCaptureWidget/cqtopencvcapturewidget.h"
+
+namespace Ui {
+class MainWindow;
+}
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+ public:
+ explicit MainWindow(QWidget *parent = 0);
+ ~MainWindow();
+
+ protected:
+ void changeEvent(QEvent *e);
+
+ private Q_SLOTS:
+ void slot_Errno(int, const QString& );
+ void slot_GetCapture(const CvCapture*);
+ void slot_GetImage(const IplImage*);
+
+
+ private:
+ Ui::MainWindow *ui;
+
+};
+
+#endif // MAINWINDOW_H
View
188 QtOpenCVWidgets/examples/testCaptureWidget/mainwindow.ui
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>648</width>
+ <height>374</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>MainWindow</string>
+ </property>
+ <widget class="QWidget" name="centralWidget">
+ <property name="minimumSize">
+ <size>
+ <width>648</width>
+ <height>250</height>
+ </size>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="CQtOpenCVCaptureWidget" name="cQtOpenCVCaptureWidget">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Адрес &lt;span style=&quot; font-weight:600;&quot;&gt;CvCapture&lt;/span&gt; в памяти&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_CaptureAddr">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Адрес &lt;span style=&quot; font-weight:600;&quot;&gt;IplImage&lt;/span&gt; в памяти&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_ImageAddr">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Preferred</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="menuBar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>648</width>
+ <height>24</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menu">
+ <property name="title">
+ <string>&amp;Файл</string>
+ </property>
+ <addaction name="action_Quit"/>
+ </widget>
+ <addaction name="menu"/>
+ </widget>
+ <widget class="QToolBar" name="mainToolBar">
+ <attribute name="toolBarArea">
+ <enum>TopToolBarArea</enum>
+ </attribute>
+ <attribute name="toolBarBreak">
+ <bool>false</bool>
+ </attribute>
+ </widget>
+ <widget class="QStatusBar" name="statusBar"/>
+ <action name="action_Quit">
+ <property name="text">
+ <string>Завершить работу</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+Q</string>
+ </property>
+ </action>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <customwidgets>
+ <customwidget>
+ <class>CQtOpenCVCaptureWidget</class>
+ <extends></extends>
+ <header>cqtopencvcapturewidget.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>action_Quit</sender>
+ <signal>activated()</signal>
+ <receiver>MainWindow</receiver>
+ <slot>close()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>-1</x>
+ <y>-1</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>323</x>
+ <y>154</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
View
34 QtOpenCVWidgets/examples/testCaptureWidget/testCaptureWidget.pro
@@ -0,0 +1,34 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2012-06-22T14:02:29
+#
+#-------------------------------------------------
+
+QT += core gui
+
+TARGET = testCaptureWidget
+TEMPLATE = app
+
+
+SOURCES += main.cpp\
+ mainwindow.cpp
+
+HEADERS += mainwindow.h \
+ ../../widgets/QtOpenCVCaptureWidget/cqtopencvcapturewidget.h
+
+
+FORMS += mainwindow.ui
+
+unix: LIBS += -L/usr/lib/ -lQtOpenCVCaptureWidget
+
+INCLUDEPATH += /usr/include \
+ $$PWD../../widgets/QtOpenCVCaptureWidget
+DEPENDPATH += /usr/include \
+ $$PWD../../widgets/QtOpenCVCaptureWidget
+
+unix: LIBS += -L/usr/lib/ -lopencv_core -lopencv_highgui
+
+INCLUDEPATH += /usr/include/opencv2/core \
+ /usr/include/opencv2/highgui
+DEPENDPATH += /usr/include/opencv2/core \
+ /usr/include/opencv2/highgui
View
81 QtOpenCVWidgets/include/qtopencv_global.h
@@ -0,0 +1,81 @@
+/*
+Copyright (c) 2012, Vladimir N. Litvinenko
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#ifndef QTOPENCV_GLOBAL_H
+#define QTOPENCV_GLOBAL_H
+
+#include <QtCore/QtGlobal>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+/*----------------------------------------------------------------------------*/
+#if defined(QTOPENCV_LIB_EXPORT)
+# define QTOPENCV_DECLARE_EXPORT Q_DECL_EXPORT
+#else
+# define QTOPENCV_DECLARE_EXPORT Q_DECL_IMPORT
+#endif
+
+/*----------------------------------------------------------------------------*/
+#define TITLE_FRAME QString::fromUtf8("Свойства устройства видеозахвата")
+#define TITLE_GROUP_BOX QString::fromUtf8("Устройство видеозахвата")
+#define TITLE_RADIO_URL QString::fromUtf8("Файл или URL")
+#define TITLE_RADIO_NUM QString::fromUtf8("Камера")
+#define TITLE_TIMEOUT QString::fromUtf8("Интервал опроса:")
+#define TITLE_TIMEOUT_EXT QString::fromUtf8("(мс)")
+#define TITLE_RECAPTURE QString::fromUtf8("Перезахват по таймауту")
+#define TITLE_CAMERA_NUMBER QString::fromUtf8("Номер вебкамеры:")
+#define TITLE_CAMERA_PATH QString::fromUtf8("Путь к источнику видео:")
+#define TITLE_BUTTON_TEST QString::fromUtf8("Проверка")
+/*----------------------------------------------------------------------------*/
+#define DEFAULT_QWERY_FRAME_INTERVAL 0
+
+/*----------------------------------------------------------------------------*/
+#define ERR_NONE 0
+
+#define ERR_CREATE_CAPTURE -1000
+#define ERR_CREATE_CAPTURE_MSG QString::fromUtf8("Ошибка инициализации устройства видеозахвата.")
+
+#define ERR_RELEASE_CAPTURE -1010
+#define ERR_RELEASE_CAPTURE_MSG QString::fromUtf8("Ошибка освобождения памяти устройством видеозахвата.")
+
+#define ERR_CREATE_IMAGE -1100
+#define ERR_CREATE_IMAGE_MSG QString::fromUtf8("Ошибка копирования изображения из выборки.")
+#define ERR_RELEASE_IMAGE -1110
+#define ERR_RELEASE_IMAGE_MSG QString::fromUtf8("Ошибка освобождения памяти изображением.")
+#define ERR_QWERY_IMAGE -1120
+#define ERR_QWERY_IMAGE_MSG QString::fromUtf8("Ошибка запроса очередного фрейма из устройства видеозахвата.")
+
+#define ERR_RESTART -1200
+#define ERR_RESTART_MSG QString::fromUtf8("Ошибка перезапуска таймаута опроса устройства видеозахвата.")
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QTOPENCV_GLOBAL_H
View
BIN  QtOpenCVWidgets/qtdesigner/QtOpenCVLogo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
4 QtOpenCVWidgets/qtdesigner/cqtopencvcapturewidget.pri
@@ -0,0 +1,4 @@
+HEADERS += \
+ ../widgets/QtOpenCVCaptureWidget/cqtopencvcapturewidget.h \
+ ../include/qtopencv_global.h
+SOURCES +=
View
109 QtOpenCVWidgets/qtdesigner/cqtopencvcapturewidgetplugin.cpp
@@ -0,0 +1,109 @@
+/*
+Copyright (c) 2012, Vladimir N. Litvinenko
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "../widgets/QtOpenCVCaptureWidget/cqtopencvcapturewidget.h"
+#include "cqtopencvcapturewidgetplugin.h"
+
+#include <QtCore/QtPlugin>
+
+CQtOpenCVCaptureWidgetPlugin::CQtOpenCVCaptureWidgetPlugin(QObject *parent)
+ : QObject(parent)
+{
+ m_initialized = false;
+}
+
+void CQtOpenCVCaptureWidgetPlugin::initialize(QDesignerFormEditorInterface * /* core */)
+{
+ if (m_initialized)
+ return;
+
+ // Add extension registrations, etc. here
+
+ m_initialized = true;
+}
+
+bool CQtOpenCVCaptureWidgetPlugin::isInitialized() const
+{
+ return m_initialized;
+}
+
+QWidget *CQtOpenCVCaptureWidgetPlugin::createWidget(QWidget *parent)
+{
+ return new CQtOpenCVCaptureWidget(parent);
+}
+
+QString CQtOpenCVCaptureWidgetPlugin::name() const
+{
+ return QLatin1String("CQtOpenCVCaptureWidget");
+}
+
+QString CQtOpenCVCaptureWidgetPlugin::group() const
+{
+ return QLatin1String("QtOpenCV Group");
+}
+
+QIcon CQtOpenCVCaptureWidgetPlugin::icon() const
+{
+ return QIcon(QLatin1String(":/QtOpenCVLogo.png"));
+}
+
+QString CQtOpenCVCaptureWidgetPlugin::toolTip() const
+{
+ return QLatin1String("Qt-OpenCV Widgets");
+}
+
+QString CQtOpenCVCaptureWidgetPlugin::whatsThis() const
+{
+ return QLatin1String("");
+}
+
+bool CQtOpenCVCaptureWidgetPlugin::isContainer() const
+{
+ return false;
+}
+
+QString CQtOpenCVCaptureWidgetPlugin::domXml() const
+{
+ return QLatin1String("\
+ <widget class=\"CQtOpenCVCaptureWidget\" name=\"cQtOpenCVCaptureWidget\">\n \
+ <property name=\"geometry\">\n \
+ <rect>\n \
+ <x>0</x>\n \
+ <y>0</y>\n \
+ <width>550</width>\n \
+ <height>195</height>\n \
+ </rect>\n \
+ </property>\n \
+ </widget>\n"
+ );
+}
+
+QString CQtOpenCVCaptureWidgetPlugin::includeFile() const
+{
+ return QLatin1String("cqtopencvcapturewidget.h");
+}
+
View
64 QtOpenCVWidgets/qtdesigner/cqtopencvcapturewidgetplugin.h
@@ -0,0 +1,64 @@
+/*
+Copyright (c) 2012, Vladimir N. Litvinenko
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#ifndef CQTOPENCVCAPTUREWIDGETPLUGIN_H
+#define CQTOPENCVCAPTUREWIDGETPLUGIN_H
+
+#include <QDesignerCustomWidgetInterface>
+#include <QtDesigner/QDesignerExportWidget>
+
+class
+ #if defined(QDESIGNER_EXPORT_WIDGETS)
+ QDESIGNER_WIDGET_EXPORT
+ #else
+ Q_DECL_EXPORT
+ #endif
+CQtOpenCVCaptureWidgetPlugin : public QObject, public QDesignerCustomWidgetInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+ public:
+ CQtOpenCVCaptureWidgetPlugin(QObject *parent = 0);
+
+ bool isContainer() const;
+ bool isInitialized() const;
+ QIcon icon() const;
+ QString domXml() const;
+ QString group() const;
+ QString includeFile() const;
+ QString name() const;
+ QString toolTip() const;
+ QString whatsThis() const;
+ QWidget *createWidget(QWidget *parent);
+ void initialize(QDesignerFormEditorInterface *core);
+
+ private:
+ bool m_initialized;
+};
+
+#endif
View
47 QtOpenCVWidgets/qtdesigner/cqtopencvcollection.cpp
@@ -0,0 +1,47 @@
+/*
+Copyright (c) 2012, Vladimir N. Litvinenko
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "cqtopencvcapturewidgetplugin.h"
+//#include "cqtopencvimagewidgetplugin.h"
+//#include "cqtopencvcannywidgetplugin.h"
+#include "cqtopencvcollection.h"
+
+CQtOpenCVCollection::CQtOpenCVCollection(QObject *parent)
+ : QObject(parent)
+{
+ m_widgets.append(new CQtOpenCVCaptureWidgetPlugin(this));
+// m_widgets.append(new CQtOpenCVImageWidgetPlugin(this));
+// m_widgets.append(new CQtOpenCVCannyWidgetPlugin(this));
+
+}
+
+QList<QDesignerCustomWidgetInterface*> CQtOpenCVCollection::customWidgets() const
+{
+ return m_widgets;
+}
+
+Q_EXPORT_PLUGIN2(CQtOpenCVCollection, CQtOpenCVCollection)
View
48 QtOpenCVWidgets/qtdesigner/cqtopencvcollection.h
@@ -0,0 +1,48 @@
+/*
+Copyright (c) 2012, Vladimir N. Litvinenko
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#ifndef CQTOPENCVCOLLECTION_H
+#define CQTOPENCVCOLLECTION_H
+
+#include <QtDesigner/QtDesigner>
+#include <QtCore/qplugin.h>
+
+class CQtOpenCVCollection : public QObject, public QDesignerCustomWidgetCollectionInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QDesignerCustomWidgetCollectionInterface)
+
+ public:
+ explicit CQtOpenCVCollection(QObject *parent = 0);
+
+ virtual QList<QDesignerCustomWidgetInterface*> customWidgets() const;
+
+ private:
+ QList<QDesignerCustomWidgetInterface*> m_widgets;
+};
+
+#endif
View
6 QtOpenCVWidgets/qtdesigner/icons.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/" >
+ <file>QtOpenCVLogo.png</file>
+
+ </qresource>
+</RCC>
View
28 QtOpenCVWidgets/qtdesigner/qtdesigner.pro
@@ -0,0 +1,28 @@
+CONFIG += designer plugin debug_and_release
+TARGET = $$qtLibraryTarget(CQtOpenCVCollection)
+TEMPLATE = lib
+
+DEFINES += QDESIGNER_EXPORT_WIDGETS
+
+#HEADERS = cqtopencvcapturewidgetplugin.h cqtopencvimagewidgetplugin.h cqtopencvcannywidgetplugin.h cqtopencvcollection.h
+#SOURCES = cqtopencvcapturewidgetplugin.cpp cqtopencvimagewidgetplugin.cpp cqtopencvcannywidgetplugin.cpp cqtopencvcollection.cpp
+HEADERS = cqtopencvcapturewidgetplugin.h cqtopencvcollection.h
+SOURCES = cqtopencvcapturewidgetplugin.cpp cqtopencvcollection.cpp
+RESOURCES = icons.qrc
+
+//target.path = $$[QT_INSTALL_PLUGINS]/designer
+INSTALLS += target
+
+#include(cqtopencvimagewidget.pri)
+include(cqtopencvcapturewidget.pri)
+#include(cqtopencvcannywidget.pri)
+
+#win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../../../usr/lib/release/ -lQtOpenCVCapture
+#else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../../../usr/lib/debug/ -lQtOpenCVCapture
+#else:symbian: LIBS += -lQtOpenCVCapture
+#else:
+unix: LIBS += -L/usr/lib/ -lQtOpenCVCaptureWidget
+# -lQtOpenCVCapture
+
+INCLUDEPATH += $$PWD/
+DEPENDPATH += $$PWD/
View
54 QtOpenCVWidgets/runtime/capture/QtOpenCVCapture/QtOpenCVCapture.pro
@@ -0,0 +1,54 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2012-06-21T10:08:46
+#
+#-------------------------------------------------
+
+QT += webkit
+
+QT -= gui
+
+TARGET = QtOpenCVCapture
+TEMPLATE = lib
+
+DEFINES += QTOPENCV_LIB_EXPORT \
+ TIMER_ON
+
+CONFIG += debug_and_release
+
+SOURCES += cqtopencvcaptureobject.cpp
+
+HEADERS += cqtopencvcaptureobject.h \
+ ../../../include/qtopencv_global.h
+
+symbian {
+ MMP_RULES += EXPORTUNFROZEN
+ TARGET.UID3 = 0xE1A5FE8F
+ TARGET.CAPABILITY =
+ TARGET.EPOCALLOWDLLDATA = 1
+ addFiles.sources = QtOpenCVCapture.dll
+ addFiles.path = !:/sys/bin
+ DEPLOYMENT += addFiles
+}
+
+unix:!symbian {
+ maemo5 {
+ target.path = /opt/usr/lib
+ } else {
+ target.path = /usr/lib
+ }
+ INSTALLS += target
+}
+
+unix: LIBS += -L/usr/lib/ -lopencv_core -lopencv_highgui
+
+INCLUDEPATH += /usr/include/opencv2/core \
+ /usr/include/opencv2/highgui
+DEPENDPATH += /usr/include/opencv2/core \
+ /usr/include/opencv2/highgui
+
+#unix:!macx:!symbian: LIBS += -L/usr/local/lib/ -lGigEVisionSDK
+
+#INCLUDEPATH += /usr/local/include/GigEVisionSDK/gige_cpp
+#DEPENDPATH += /usr/local/include/GigEVisionSDK/gige_cpp
+
View
808 QtOpenCVWidgets/runtime/capture/QtOpenCVCapture/cqtopencvcaptureobject.cpp
@@ -0,0 +1,808 @@
+/*
+Copyright (c) 2012, Vladimir N. Litvinenko
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "cqtopencvcaptureobject.h"
+#include <QTimerEvent>
+#include <QTextCodec>
+
+/**
+ \def STRICT_CAMERA_NUMBER
+ \brief Макрос приведения номера вебкамеры к корретному значению
+ \param value - порядковый номер вебкамеры на компьютере
+*/
+#define STRICT_CAMERA_NUMBER(value) \
+ ((value) > 0 ? (value) : CV_CAP_ANY)
+
+/*----------------------------------------------------------------------------*/
+class CQtOpenCVCaptureObjectPrivate
+{
+ Q_DECLARE_PUBLIC(CQtOpenCVCaptureObject)
+ public:
+ CQtOpenCVCaptureObjectPrivate ( CQtOpenCVCaptureObject* owner );
+ virtual
+ ~CQtOpenCVCaptureObjectPrivate ();
+
+ void init ();
+ void release ();
+
+ void free_capture ();
+ void alloc_capture ();
+
+ void free_image ();
+ void alloc_image ();
+
+ int frame_count () const;
+ bool is_recap () const;
+ void recap( bool );
+
+ void set_camera_number ( int );
+ void set_camera_file ( const QString& );
+ void set_as_internal ( bool );
+
+ void captureOn ( bool );
+
+ void set_timer_interval ( int );
+ void start ();
+ void stop ();
+ bool isActive () const;
+
+ IplImage* getOpenCVImage () const;
+
+ CQtOpenCVCaptureObject* q_ptr;
+
+ CvCapture* p_capture; ///< указатель на устройство видеозахвата
+ IplImage* p_image; ///< указатель на текущий фидеофрейм (не копия!) устройства видеозахвата
+ QString f_path; ///< URL сетевой видеокамеры или путь и файл видеоролика
+ int f_camera_num; ///< номер встроенной видеокамеры
+ bool f_internal; ///< признак использования встроенной видеокамеры
+ int f_errno; ///< номер кода ошибки
+ bool f_recap; ///< признак переинициализации устройства при количестве фреймов меньше двух
+
+ int f_timerUID; ///< UID таймера класса QObject
+ int f_timerInterval; ///< интервал тайм-аута срабатывания таймера
+};
+
+/*----------------------------------------------------------------------------*/
+/**
+ \internal
+ \fn inline void CQtOpenCVCaptureObjectPrivate::init ()
+ \brief Установка свойств класса в начальное значение.
+*/
+inline void
+CQtOpenCVCaptureObjectPrivate::init ()
+{
+ f_errno = 0,
+
+ p_capture = NULL,
+ p_image = NULL,
+
+ f_camera_num = CV_CAP_ANY,
+ f_internal = true,
+ f_recap = false;
+
+ f_path.clear ();
+
+ f_timerUID = 0, f_timerInterval = DEFAULT_QWERY_FRAME_INTERVAL;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \internal
+ \fn inline void CQtOpenCVCaptureObjectPrivate::release ()
+ \brief
+*/
+inline void
+CQtOpenCVCaptureObjectPrivate::release ()
+{
+ free_capture ();
+ init ();
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \internal
+ \fn
+ \brief
+*/
+inline void
+CQtOpenCVCaptureObjectPrivate::free_capture ()
+{
+ f_errno = ERR_NONE; // код ошибки сброшен
+
+ // останов механизма запроса изображения по тайм-ауту
+ stop ();
+
+ free_image ();
+
+ if(p_capture) {
+ // освобождение устройства захвата методом библиотеки OpenCV
+ try {
+ cvReleaseCapture(&p_capture);
+ }catch(...) {
+ // не сработало... Сообщим об этом в ЦК КПСС
+ f_errno = ERR_RELEASE_CAPTURE;
+ emit q_ptr->signal_Errno (f_errno, ERR_RELEASE_CAPTURE_MSG);
+ //... возможна утечка памяти: мы не видим "внутренностей" cvReleaseCapture
+ }
+ }
+ p_capture = NULL; // обязательно!
+ emit q_ptr->signal_CaptureChanged ();
+ emit q_ptr->signal_CaptureChanged (p_capture);
+
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \internal
+ \fn CQtOpenCVCaptureObjectPrivate::CQtOpenCVCaptureObjectPrivate ( CQtOpenCVCaptureObject* owner )
+ \brief Конструктор.\n
+ \param owner - указатель на объект главного класса типа \a CQtOpenCVCaptureObject.
+ Проверка указателя на объект главного класса и инициализация значений
+*/
+CQtOpenCVCaptureObjectPrivate::CQtOpenCVCaptureObjectPrivate ( CQtOpenCVCaptureObject* owner )
+ : q_ptr(owner)
+{
+ Q_ASSERT(q_ptr);
+ init ();
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \internal
+ \fn CQtOpenCVCaptureObjectPrivate::~CQtOpenCVCaptureObjectPrivate ()
+ \brief Деструктор\n
+ Всё очистить, память освободить.
+*/
+CQtOpenCVCaptureObjectPrivate::~CQtOpenCVCaptureObjectPrivate ()
+{
+ release ();
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \internal
+ \fn inline bool CQtOpenCVCaptureObjectPrivate::isActive ()
+ \brief Проверка активности механизма получения указателя на изображение из
+ устройства видеозахвата \a p_capture по тайм-ауту.\n
+ \attention Если макрос TIMER_ON не объявлен при сборке проекта, то возвращаемое
+ значение -- всегда "логическая ложь".
+*/
+inline bool
+CQtOpenCVCaptureObjectPrivate::isActive () const
+{
+ return (f_timerUID > 0);
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \internal
+ \fn [inline] int CQtOpenCVCaptureObjectPrivate::frame_count ()
+ \brief Метод представления количества фреймов в устройстве захвата.
+ \return Возвращает количество фреймов в устройстве захвата, используя методы
+ библиотеки OpenCV.
+*/
+inline int
+CQtOpenCVCaptureObjectPrivate::frame_count () const
+{
+ return (
+ p_capture != NULL ?
+ (int)cvGetCaptureProperty (p_capture, CV_CAP_PROP_FRAME_COUNT) :
+ 0
+ );
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \internal
+ \fn [inline] bool CQtOpenCVCaptureObjectPrivate::is_recap ()
+ \brief Метод представления условия переинициализации устройства захвата по тайм-ауту.
+ \return Возвращает значение true, если таймер предоставления изображения
+ каждый раз переинициализирует устройство видеозахвата перед получением нового
+ фрейма.
+ \n
+ Переинициализация может быть необходима при обращении к сетевой видеокамере,
+ например, через веб-интерфейс встроенного в камеру сервера, когда последний
+ может транслировать видео только покадрово.
+*/
+inline bool
+CQtOpenCVCaptureObjectPrivate::is_recap () const
+{
+ return (f_recap);
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \internal
+ \fn [inline] void CQtOpenCVCaptureObjectPrivate::recap( bool value )
+ \brief Метод установки условия переинициализации устройства захвата по тайм-ауту.
+ \param value - признак переинициализации (значение true) устройства видеозахвата
+ по тайм-ауту получения изображения.
+*/
+inline void
+CQtOpenCVCaptureObjectPrivate::recap( bool value )
+{
+ if(f_recap != value) {
+ bool b_active = isActive ();
+
+ stop ();
+ f_recap = value;
+ if(b_active) start ();
+ }
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \internal
+ \fn void CQtOpenCVCaptureObjectPrivate::alloc_capture ()
+ \brief Метод распределения памяти для нового устройства \a p_capture видеозахвата.
+*/
+void
+CQtOpenCVCaptureObjectPrivate::alloc_capture ()
+{
+// free_capture (); // освободить ресурсы предыдущего устройсва
+
+ if(/*(f_errno != ERR_NONE) || */(p_capture != NULL)) return;
+
+ f_errno = ERR_NONE;
+ bool b_active = isActive ();
+ stop ();
+
+ try {
+ if(f_internal) {
+ // встроенная видеокамера
+ p_capture = cvCreateCameraCapture(f_camera_num);
+ } else {
+ // внешняя (сетевая) видеокамера или видеоролик
+ if(!f_path.isNull ())
+ if(!f_path.isEmpty ()) {
+ // путь или сетевой адрес указаны
+ p_capture = cvCreateFileCapture(f_path.toStdString ().c_str ());
+ }
+ }
+ }catch(...) {
+ // что-то пошло не так... Нужели "съели" всю память? Не-е-ет. Скорее, номер
+ // или путь содержат неверные значения!
+ f_errno = ERR_CREATE_CAPTURE;
+ emit q_ptr->signal_Errno (f_errno, ERR_CREATE_CAPTURE_MSG);
+ free_capture ();// на непредвиденную ошибку
+ }
+
+ if(p_capture) {
+ // сообщение о состоянии указателя на устройство видеозахвата
+ emit q_ptr->signal_CaptureChanged ();
+
+ if(b_active) start ();
+ } else {
+ }
+
+ emit q_ptr->signal_CaptureChanged (p_capture);
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \internal
+ \fn [inline] void CQtOpenCVCaptureObjectPrivate::free_image ()
+ \brief Метод освобождения ресурсов свойства \a p_image класса указателя на изображение.
+ \n
+ \attention Функция cvReleaseImage не используется, т.к. значение свойства
+ CQtOpenCVCaptureObjectPrivate::p_image формируется вызовом метода cvQueryFrame
+ библиотеки OpenCV. Для работы с изображением используйте копию указателя на фрейм
+ вызовом функции cvCloneImage библиотеки OpenCV.
+ \n
+ См. \a alloc_image
+*/
+inline void
+CQtOpenCVCaptureObjectPrivate::free_image ()
+{
+ p_image = NULL;
+ emit q_ptr->signal_ImageChanged (NULL);
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \internal
+ \fn void CQtOpenCVCaptureObjectPrivate::alloc_image ()
+ \brief Метод извлечения очередного изображения из устройства видеозахвата.
+*/
+void
+CQtOpenCVCaptureObjectPrivate::alloc_image ()
+{
+ f_errno = ERR_NONE;
+ if(p_capture) {
+ p_image = cvQueryFrame( p_capture );
+
+ if(p_image == NULL) {
+ f_errno = ERR_CREATE_IMAGE;
+ emit q_ptr->signal_Errno (f_errno, ERR_CREATE_IMAGE_MSG);
+ }
+
+ emit q_ptr->signal_ImageChanged ( p_image );
+ }
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \internal
+ \fn [inline] void CQtOpenCVCaptureObjectPrivate::captureOn ( bool value )
+ \brief Метод начальной инициализации устройства видеозахвата и перезапуска
+ запроса на текущее изображение по тайм-ауту.
+ \n
+ \param value -- признак включения (значение true) и отключения (значение false)
+ устройства видеозахвата
+ \n
+ \warning При отключённой возможности запроса на текущее изображение по тайм-ауту,
+ но при отсутствии указателя на устройство видеозахвата, просто, создаёт его.
+ \n
+ См. \a alloc_capture, \a free_capture, \a captureOn
+*/
+inline void
+CQtOpenCVCaptureObjectPrivate::captureOn ( bool value )
+{
+ if(value) alloc_capture ();
+ else free_capture ();
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \internal
+ \fn void CQtOpenCVCaptureObjectPrivate::set_camera_number ( int value )
+ \brief Метод установки номера вебкамеры компьютера.
+ \param value - значение номера вебкамеры
+*/
+void
+CQtOpenCVCaptureObjectPrivate::set_camera_number ( int value )
+{
+ if(f_camera_num != value ) {
+ if(f_internal) {
+ bool b_exist = p_capture != NULL;
+ captureOn (false);
+ f_camera_num = STRICT_CAMERA_NUMBER(value);
+ if(b_exist) captureOn (true);
+ }
+ }
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ \internal
+ \fn void CQtOpenCVCaptureObjectPrivate::set_camera_file ( const QString& value )
+ \brief Метод установки пути к сетевой камере или видеоролику.
+ \param value - путь к сетевой камере или видеоролику.
+*/
+void
+CQtOpenCVCaptureObjectPrivate::set_camera_file ( const QString& value )
+{
+ if(f_path != value) {
+ if(!f_internal) {
+ bool b_exist = p_capture != NULL;
+ captureOn (false);
+ f_path = value;
+ if(b_exist) captureOn (true);
+ }
+ }
+}
+/*----------------------------------------------------------------------------*/
+/**
+ \internal
+ \fn void CQtOpenCVCaptureObjectPrivate::set_as_internal ( bool value )
+ \brief Метод определения устройства видеозахвата как вебкамера или сетевое устройство/видеоролик
+ \param value - значение true направляет устройство захвата на работу со
+ встроенной видеокамерой с номером значения \a f_camera_num
+ свойства класса, а значение false -- на работу с сетевой
+ камерой или видеороликом, расположенным по адресу значения
+ \a f_path свойства класса.
+*/
+void
+CQtOpenCVCaptureObjectPrivate::set_as_internal ( bool value )
+{
+ if(f_internal != value) {
+ bool b_exist = p_capture != NULL;
+ captureOn (false);
+ f_internal = value;
+ if(b_exist) captureOn (true);
+ }
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \internal
+ \fn [inline] void CQtOpenCVCaptureObjectPrivate::set_timer_interval ( int value )
+ \brief Метод установки интервала тайм-аута запроса текущего изображения от
+ устройства видеозахвата.
+ \param value - значение тайм-аута в миллисекундах.
+*/
+inline void
+CQtOpenCVCaptureObjectPrivate::set_timer_interval ( int value )
+{
+ if(value != f_timerInterval) {
+ bool b_active = isActive ();
+ stop ();
+ f_timerInterval = value > -1 ? value : DEFAULT_QWERY_FRAME_INTERVAL;
+ emit q_ptr->signal_TimeoutChanged ();
+ emit q_ptr->signal_TimeoutChanged (f_timerInterval);
+ if(b_active) start ();
+ }
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \internal
+ \fn [inline] void CQtOpenCVCaptureObjectPrivate::start ()
+ \brief Метод запуска извлечения копий фреймов (указателей на изображение) из
+ устройства \a p_capture видеозахвата по тайм-ауту.
+*/
+inline void
+CQtOpenCVCaptureObjectPrivate::start ()
+{
+ if(f_timerInterval > 0 && (!isActive ())) {
+ f_timerUID = q_ptr->startTimer (f_timerInterval);
+ emit q_ptr->signal_ActiveChanged (isActive ());
+ }
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \internal
+ \fn [inline] void CQtOpenCVCaptureObjectPrivate::stop ()
+ \brief Метод останова извлечения копий фреймов (указателей на изображение) из
+ устройства \a p_capture видеозахвата по тайм-ауту.
+*/
+inline void
+CQtOpenCVCaptureObjectPrivate::stop ()
+{
+ if(isActive ()) {
+ q_ptr->killTimer (f_timerUID);
+ emit q_ptr->signal_ActiveChanged ((bool)(f_timerUID = 0));
+ }
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \internal
+ \fn [inline] IplImage* CQtOpenCVCaptureObjectPrivate::getOpenCVImage ()
+ \brief Метод доступа к изображению копии текущего фрейма устройства видеозахвата
+ \return Указатель на переменную типа \a IplImage библиотеки OpenCV
+*/
+inline IplImage*
+CQtOpenCVCaptureObjectPrivate::getOpenCVImage () const
+{
+ return p_image ? cvCloneImage (p_image) : NULL;
+}
+
+/*----------------------------------------------------------------------------*/
+/* CQtOpenCVCaptureObject */
+/*----------------------------------------------------------------------------*/
+/**
+ \fn CQtOpenCVCaptureObject::CQtOpenCVCaptureObject( QObject *parent )
+ \brief Конструктор класса.
+ \param parent - родительский объект типа QObject или его наследник.
+*/
+CQtOpenCVCaptureObject::CQtOpenCVCaptureObject( QObject *parent ) :
+ QObject(parent)
+, d_ptr(new CQtOpenCVCaptureObjectPrivate(this))
+{
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \fn CQtOpenCVCaptureObject::~CQtOpenCVCaptureObject()
+ \brief Деструктор класса.
+*/
+CQtOpenCVCaptureObject::~CQtOpenCVCaptureObject()
+{
+ d_func ()->stop ();
+ d_func ()->captureOn (false);
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \fn bool CQtOpenCVCaptureObject::isActive ()
+ \brief Проверка активности механизма получения указателя на изображение из
+ устройства видеозахвата по тайм-ауту.
+ \n
+ \attention Если макрос TIMER_ON не объявлен при сборке проекта, то возвращаемое
+ значение -- всегда "логическая ложь".
+*/
+bool
+CQtOpenCVCaptureObject::isActive () const
+{
+ return (d_func ()->isActive ());
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \fn bool CQtOpenCVCaptureObject::isRecap ()
+ \brief Метод представления условия переинициализации устройства захвата по тайм-ауту.
+ \return Возвращает значение true, если таймер предоставления изображения
+ каждый раз переинициализирует устройство видеозахвата перед получением нового
+ фрейма.
+ \n
+ Переинициализация может быть необходима при обращении к сетевой видеокамере,
+ например, через веб-интерфейс встроенного в камеру сервера, когда последний
+ может транслировать видео только покадрово.
+*/
+bool
+CQtOpenCVCaptureObject::isRecap () const
+{
+ return (d_func ()->is_recap ());
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \fn CvCapture* CQtOpenCVCaptureObject::getCapture () [const]
+ \brief Метод получения указателя на свойство класса устройства видеозахвата.
+ \return Указатель на объект устройства видеозахвата типа CvCapture библиотеки OpenCV.
+*/
+CvCapture*
+CQtOpenCVCaptureObject::getCapture () const
+{
+ return (d_func ()->p_capture);
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \fn bool CQtOpenCVCaptureObject::isInternal () [const]
+ \brief Метод показывает, используется ли внутренняя вебкамера или идёт
+ трансляция из сетевого устройства или видеоролика.
+ \return Возвращает значение true, если устройство видеозахвата настроено на
+ одну из внутренних видеокамер компьютера. Если трансляция ведётся из сетевого
+ устройства или видеоролика, то метод возвращаент значение false.
+ \n
+ См. \a isExternal, \a getCameraNumber
+*/
+bool
+CQtOpenCVCaptureObject::isInternal () const
+{
+ return (d_func ()->f_internal);
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \fn
+ \brief Метод показывает, используется ли трансляция из сетевого устройства
+ или видеоролика или работает внутренняя вебкамера.
+ \return Если трансляция ведётся из сетевого устройства или видеоролика, то
+ метод возвращаент значение true. Возвращает значение false, если устройство
+ видеозахвата настроено на одну из внутренних видеокамер компьютера.
+ \n
+ Метод введён для удобства пользователя и является противоположностью
+ метода \a isInternal.
+ \attention Размещено в файле реализации класса, а не inline, т.к. возможно использование
+ как PROPERTY( ... READ isExternal ...)
+ См. \a isInternal, \a getPath
+*/
+bool
+CQtOpenCVCaptureObject::isExternal () const
+{
+ return (!isInternal ());
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \fn QString CQtOpenCVCaptureObject::getPath () [const]
+ \brief Метод длаёт доступ к пути сетевого видеоустройства или файлу видеоролика.
+ \return Возвращает значения типа QString пути сетевого видеоустройства или
+ файла видеоролика.
+ \n
+ См. \a getCameraNumber, \a isExternal
+*/
+QString
+CQtOpenCVCaptureObject::getPath () const
+{
+ return (d_func ()->f_path);
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \fn int CQtOpenCVCaptureObject::getNumber () [const]
+ \brief Метод показывает номер встроенной видеокамеры, на которую сориентированно
+ устройство видеозахвата.
+ \return Возвращает значение номера встроенной видеокамеры.
+ \n
+ См. \a getPath, \a isInternal
+*/
+int
+CQtOpenCVCaptureObject::getNumber () const
+{
+ return (d_func ()->f_camera_num);
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \fn int CQtOpenCVCaptureObject::getTimeoutInterval () [const]
+ \brief Метод получения значения интервала тайм-аута опроса текущего изображения
+ из устройства видеозахвата.
+ \return Возвращает значение интервала тайм-аута опроса текущего изображения из
+ устройства видеозахвата.
+*/
+int
+CQtOpenCVCaptureObject::getTimeoutInterval () const
+{
+ return (d_func ()->f_timerInterval);
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \fn IplImage*
+ \brief Метод доступа к изображению копии текущего фрейма устройства видеозахвата
+ \return Указатель на переменную типа \a IplImage библиотеки OpenCV
+*/
+IplImage*
+CQtOpenCVCaptureObject::getImage () const
+{
+ return (d_func ()->getOpenCVImage ());
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \fn int CQtOpenCVCaptureObject::getFrameCount ()
+ \brief Метод представления количества фреймов в устройстве захвата.
+ \return Возвращает количество фреймов в устройстве захвата, используя методы
+ библиотеки OpenCV.
+*/
+int
+CQtOpenCVCaptureObject::getFrameCount () const
+{
+ return (d_func ()->frame_count ());
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \fn [SLOT] void CQtOpenCVCaptureObject::slot_SetAsInternal ( bool value )
+ \brief Слот определения устройства видеозахвата как вебкамера или сетевое
+ устройство/видеоролик.
+ \param value - значение true направляет устройство захвата на работу со
+ встроенной видеокамерой с номером значения \a f_camera_num
+ свойства класса, а значение false -- на работу с сетевой
+ камерой или видеороликом, расположенным по адресу значения
+ \a f_path свойства класса.
+*/
+void
+CQtOpenCVCaptureObject::slot_SetAsInternal ( bool value )
+{
+ d_func ()->set_as_internal (value);
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \fn [SLOT] void CQtOpenCVCaptureObject::slot_SetNumber ( int value )
+ \brief Слот установки номера вебкамеры компьютера.
+ \param value - значение номера вебкамеры
+*/
+void
+CQtOpenCVCaptureObject::slot_SetNumber ( int value )
+{
+ d_func ()->set_camera_number (value);
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \fn [SLOT] void CQtOpenCVCaptureObject::slot_SetPath ( const QString& value )
+ \brief Слот установки пути к сетевой камере или видеоролику.
+ \param value - путь к сетевой камере или видеоролику.
+*/
+void
+CQtOpenCVCaptureObject::slot_SetPath ( const QString& value )
+{
+ d_func ()->set_camera_file (QString(value.toUtf8 ()));
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \fn [SLOT] void CQtOpenCVCaptureObject::slot_SetTimeout ( int value )
+ \brief Слот установки тайм-аута опроса устройства видеозахвата на получение текущего изображения.
+ \param value -- значение тайм-аута.
+*/
+void
+CQtOpenCVCaptureObject::slot_SetTimeout ( int value )
+{
+ d_func ()->set_timer_interval (value);
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \fn [SLOT] void CQtOpenCVCaptureObject::slot_captureOn ( bool value )
+ \brief Слот начальной инициализации устройства видеозахвата и перезапуска
+ запроса на текущее изображение по тайм-ауту.
+ \param value -- признак включения (значение true) и отключения (значение false) устройства видеозахвата
+ \n
+ \warning При отключённой возможности запроса на текущее изображение по тайм-ауту,
+ но при отсутствии указателя на устройство видеозахвата, просто, создаёт его.
+ \n
+*/
+void
+CQtOpenCVCaptureObject::slot_captureOn ( bool value )
+{
+ d_func ()->captureOn ( value );
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \fn [virtual] void CQtOpenCVCaptureObject::timerEvent(QTimerEvent *event)
+ \brief Переопределённый для QObject виртуальный обработчик события таймера.
+*/
+void
+CQtOpenCVCaptureObject::timerEvent(QTimerEvent *event)
+{
+ if(// если...
+ (event->timerId () == d_func ()->f_timerUID)// ... нужное событие ...
+ && // ... и ...
+ (isActive ()) // ... таймер включен ...
+ && // ... и ...
+ (d_func ()->p_capture != NULL) // ... устройство определено ...
+ )
+ {
+ d_func ()->f_errno = ERR_NONE;
+ d_func ()->stop ();
+ try {
+ if(d_func ()->is_recap () /*&& (d_func ()->frame_count () < 1)*/) {
+ d_func ()->free_capture ();
+ d_func ()->alloc_capture ();
+ }
+
+ if(d_func ()->p_capture) {
+ d_func ()->alloc_image ();
+ if(d_func ()->f_errno != ERR_CREATE_CAPTURE)
+ d_func ()->start ();
+ }
+
+ } catch(...) {
+ d_func ()->f_errno = ERR_RESTART;
+ emit signal_Errno (d_func ()->f_errno, ERR_RESTART_MSG);
+ }
+ }
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \fn [SLOT] void CQtOpenCVCaptureObject::slot_Activate (bool value)
+ \brief Слот управления таймером извлечения фреймов из устройства видеозахвата.
+ \param value -- признак запуска (true) или останова (false) таймера.
+ Слот работает при наличии макроса TIMER_ON.
+*/
+void
+CQtOpenCVCaptureObject::slot_Activate (bool value)
+{
+ if(value) d_func ()->start ();
+ else d_func ()->stop ();
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ \fn void CQtOpenCVCaptureObject::slot_SetRecap( bool value )
+ \brief Метод установки условия переинициализации устройства захвата по тайм-ауту.
+ \param value - признак переинициализации (значение true) устройства видеозахвата
+ по тайм-ауту получения изображения.
+*/
+void
+CQtOpenCVCaptureObject::slot_SetRecap<