ACT-CV - Machine Vision for Cognitive Modeling
TestFrameSource.cpp
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) 2008 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 #include <iostream>
29 
30 #include "TestFrameSource.h"
31 
32 
33 using namespace std;
34 
36 {
37 }
38 
40  MHDBGMSG(__FILE__,__LINE__,__PRETTY_FUNCTION__);
41 
42  // automatically release older ones
43  curImg=new ImageHolder(size, IPL_DEPTH_8U, 1);
44 
45  for (int x=0;x<size.width;x++) {
46  for (int y=0;y<size.height;y++) {
47  cvSetReal2D(curImg->GetImage(), y, x, rv_(rgen_));
48  }
49  }
50 
51  n++;
52 
53  MHDBGMSG(__FILE__,__LINE__,__PRETTY_FUNCTION__);
54  return curImg->GetImage();
55 }
56 
58  return n;
59 }
60 
61 
63  MHDBGMSG(__FILE__,__LINE__,__PRETTY_FUNCTION__);
64 
65  // automatically release older ones
66  curImg=new ImageHolder(size, IPL_DEPTH_8U, 3);
67 
68  // new pos
69  n++;
70  SetCentralXPos(static_cast<int>(size.width/2 + sin(n*.12)*100));
71 
72  cvZero(curImg->GetImage());
73  for (int x=0;x<size.width;x++) {
74  for (int y=0;y<size.height;y++) {
75  int gray=static_cast<int>(rv_(rgen_));
76  cvSet2D(curImg->GetImage(), y, x, CV_RGB(gray,gray,gray));
77  }
78  }
79 
80  for (int i=0;i<4;i++) {
81  //cout << lineEnds[i] << endl;
82  cvLine(curImg->GetImage(),
83  centralPoint, lineEnds[i],
84  CV_RGB(255,255,255),
85  1, // Dicke
86  CV_AA,
87  0);
88  }
89 
90 
91  MHDBGMSG(__FILE__,__LINE__,__PRETTY_FUNCTION__);
92  return curImg->GetImage();
93 }
94 
96  MHDBGMSG(__FILE__,__LINE__,__PRETTY_FUNCTION__);
97 
99 
100  if (frameCounter++ > 20) {
101  frameCounter = 0;
102  curLineEnd = static_cast<int>(rv_(rgen_));
103  }
104 
105  cvLine(curImg->GetImage(),
106  GetCentralPoint(),
107  cvPoint(curLineEnd, curImg->GetImage()->height-1),
108  CV_RGB(255,255,255),
109  3, // Dicke
110  CV_AA,
111  0);
112 
113  MHDBGMSG(__FILE__,__LINE__,__PRETTY_FUNCTION__);
114  return curImg->GetImage();
115 }


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