-
Notifications
You must be signed in to change notification settings - Fork 0
/
vissynth.cpp
57 lines (47 loc) · 1.34 KB
/
vissynth.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/**
* vissynth.cpp: Controller source for vissynth application.
* AUTHORS:
* Chang
* Evan
* Sam ([email protected])
* Yui
*/
#include <iostream>
#include "cv.h"
#include "ml.h"
#include "cxcore.h"
#include "cxtypes.h"
#include "highgui.h"
#include "image_generator.h"
/*
#include "sound_generator.h"
#include "view.h"
*/
#define MAX_BIT_REP_ROWS 100
#define MAX_BIT_REP_COLS 100
using namespace std;
int main(int argc, char** argv) {
ImageGenerator imgGen;
BitRep br(32, 24); // imgGen is parameterized by the size of br :)
int frameDelay = 200; // milliseconds to wait between processing frames
if(!imgGen.init()) {
fprintf(stderr, "Error initializing Image Generator - check webcam?\n");
getchar();
return -1;
}
// Show the image captured from the camera in the window and repeat
while(true) {
if(!imgGen.pullImage(br)) {
fprintf(stderr, "Error pulling a frame from the webcam\n");
getchar();
return -1;
}
// print out the bitrep to the console - or play music with it! :)
br.display();
// Wait frameDelay ms, then check if the key pressed is ESC
// If it is, then break
if((cvWaitKey(frameDelay) & 255) == 27)
break;
}
return 0;
}