Permalink
Browse files

Initial commit

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

Signed-off-by: coffeesmoke <vladimir.litvinenko@codepaint.ru>
  • Loading branch information...
1 parent edb9726 commit bff7aed2d5b630e3c9aee461b597e57ccfda0d0e @coffeesmoke committed Jul 26, 2012
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
@@ -0,0 +1,6 @@
+TEMPLATE=subdirs
+SUBDIRS=runtime \
+# images \
+ examples \
+ widgets \
+ qtdesigner
@@ -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
@@ -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);
+}
+
@@ -0,0 +1,9 @@
+TEMPLATE = subdirs
+#SUBDIRS = testOpenCVImage \
+# testOpenCVCanny \
+# testPureOpenCVCapture
+SUBDIRS = \
+# app4UIModeling \
+ testCaptureRuntime \
+ testCaptureWidget \
+ OpenCVAviVideo
@@ -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();
+}
@@ -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);
+}
@@ -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
Oops, something went wrong.

0 comments on commit bff7aed

Please sign in to comment.