ACT-CV - Machine Vision for Cognitive Modeling
QtFrameSource.h
Go to the documentation of this file.
1 // -*- mode: c++; indent-tabs-mode: nil; c-basic-offset: 4; coding: iso-8859-1; -*-
2 
3 /*
4 ACT-CV - Machine Vision for Cognitive Modeling
5 Copyright (c) 2010 Marc Halbruegge
6 
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11 
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21 
22 
28 #pragma once
29 
30 #include "FrameSource.h"
31 
32 #include <QtGui>
33 #include <QtWebKit>
34 #include <QWebPage>
35 
37 class QtFrameSource: public FrameSource {
38  int width_;
39  int height_;
40 
41  QWebPage page_;
42  IplImage* image_;
43  int n_;
44 
45  int mouseX_;
46  int mouseY_;
47 
48  std::vector<RegionInfo> regions_;
49  bool walkTree(const QWebElement& elem);
50 
51  QtFrameSource(const char* url, int width=960, int height=768);
52 
53 public:
55 
56  virtual IplImage* GetNextFrame();
57  virtual int GetFrameNr() const;
58  virtual size_t GetNumInfos() const;
59  virtual const RegionInfo& GetInfo(size_t idx) const;
60 
63  void SetMousePos(int x, int y);
64  void DoClick(int button);
65  void DoPressKey(int key);
67 
68  static FrameSource* QtSourceFactory(const char *url);
69 };
70 
72 class QtCaptureSource : public FrameSource {
73  friend class QtFrameSource;
74 
75  int width_;
76  int height_;
77 
78  IplImage* image_;
79  int n_;
80 
81  QtCaptureSource(int width=640, int height=480);
82 
83 public:
85 
86  IplImage* GetNextFrame();
87  int GetFrameNr() const;
88 };


ACT-CV - Machine Vision for Cognitive Modeling
© 2015 Marc Halbruegge (actcvlibrary@googlemail.com)