Subversion Repositories OpenCV2-Cookbook

Rev

Rev 3 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3 Rev 5
1
/*------------------------------------------------------------------------------------------*\
1
/*------------------------------------------------------------------------------------------*\
2
   This file contains material supporting chapter 3 of the cookbook:  
2
   This file contains material supporting chapter 3 of the cookbook:  
3
   Computer Vision Programming using the OpenCV Library.
3
   Computer Vision Programming using the OpenCV Library.
4
   by Robert Laganiere, Packt Publishing, 2011.
4
   by Robert Laganiere, Packt Publishing, 2011.
5

5

6
   This program is free software; permission is hereby granted to use, copy, modify,
6
   This program is free software; permission is hereby granted to use, copy, modify,
7
   and distribute this source code, or portions thereof, for any purpose, without fee,
7
   and distribute this source code, or portions thereof, for any purpose, without fee,
8
   subject to the restriction that the copyright notice may not be removed
8
   subject to the restriction that the copyright notice may not be removed
9
   or altered from any source or altered source distribution.
9
   or altered from any source or altered source distribution.
10
   The software is released on an as-is basis and without any warranties of any kind.
10
   The software is released on an as-is basis and without any warranties of any kind.
11
   In particular, the software is not guaranteed to be fault-tolerant or free from failure.
11
   In particular, the software is not guaranteed to be fault-tolerant or free from failure.
12
   The author disclaims all warranties with regard to this software, any use,
12
   The author disclaims all warranties with regard to this software, any use,
13
   and any consequent failure, is purely the responsibility of the user.
13
   and any consequent failure, is purely the responsibility of the user.
14
 
14
 
15
   Copyright (C) 2010-2011 Robert Laganiere, www.laganiere.name
15
   Copyright (C) 2010-2011 Robert Laganiere, www.laganiere.name
16
\*------------------------------------------------------------------------------------------*/
16
\*------------------------------------------------------------------------------------------*/
17
17
18
#ifndef MAINWINDOW_H
18
#ifndef MAINWINDOW_H
19
#define MAINWINDOW_H
19
#define MAINWINDOW_H
20
20
21
#include <QMainWindow>
21
#include <QMainWindow>
22
#include <QFileDialog>
22
#include <QFileDialog>
23
#include <QColorDialog>
23
#include <QColorDialog>
24
24
25
//OpenCV
25
//OpenCV
26
#include "cv.h"
26
#include <opencv/cv.h>
27
#include "highgui.h"
27
#include <opencv/highgui.h>
28
28
29
//color detector, controller
29
//color detector, controller
30
#include "colorDetectController.h"
30
#include "colorDetectController.h"
31
#include "colordetector.h"
31
#include "colordetector.h"
32
32
33
namespace Ui {
33
namespace Ui {
34
    class MainWindow;
34
    class MainWindow;
35
}
35
}
36
36
37
class MainWindow : public QMainWindow {
37
class MainWindow : public QMainWindow {
38
    Q_OBJECT
38
    Q_OBJECT
39
public:
39
public:
40
    MainWindow(QWidget *parent = 0);
40
    MainWindow(QWidget *parent = 0);
41
    ~MainWindow();
41
    ~MainWindow();
42
42
43
protected:
43
protected:
44
    void changeEvent(QEvent *e);
44
    void changeEvent(QEvent *e);
45
    void displayMat(const cv::Mat& img);
45
    void displayMat(const cv::Mat& img);
46
46
47
    //Main Image
47
    //Main Image
48
    //cv::Mat img_mat;
48
    //cv::Mat img_mat;
49
49
50
private:
50
private:
51
    Ui::MainWindow *ui;
51
    Ui::MainWindow *ui;
52
52
53
private slots:
53
private slots:
54
    void on_pushButton_color_clicked();
54
    void on_pushButton_color_clicked();
55
    void processColorDetection();
55
    void processColorDetection();
56
    void on_verticalSlider_Threshold_valueChanged(int value);
56
    void on_verticalSlider_Threshold_valueChanged(int value);
57
57
58
    void setColor();
58
    void setColor();
59
    void setImage();
59
    void setImage();
60
60
61
61
62
};
62
};
63
63
64
#endif // MAINWINDOW_H
64
#endif // MAINWINDOW_H
65
 
65