-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
67 lines (52 loc) · 1.5 KB
/
main.cpp
File metadata and controls
67 lines (52 loc) · 1.5 KB
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
58
59
60
61
62
63
64
65
66
67
#include <opencv/cvaux.h>
#include <opencv/highgui.h>
#include <opencv/cxcore.h>
#include <stdio.h>
#include <stdlib.h>
#include "cores.h"
#include "processamento.h"
int main(){
CvSize padrao = cvSize(640, 480);
CvCapture* camera;
camera = cvCaptureFromCAM(1); //ID DA CAMERA USADA, 0 = Padrão, 1 = Secundária;
IplImage* inicial = cvQueryFrame(camera);
IplImage* img[4];
int n = 2; //NUMERO DE CORES ALOCADAS;
for(int i = 0 ; i < n ; i++){
img[i] = cvQueryFrame(camera);
img[i] = cvCreateImage(padrao, IPL_DEPTH_8U, 1);
}
CvMemStorage* c[4];
float x[4] = {0,0,0,0}, y[4] = {0,0,0,0};
int render = 0;
struct cor structc[4];
structc[0] = azul(); // DEFINICAO DAS CORES USADAS;
structc[1] = vermelho();
cvNamedWindow("Vision", CV_WINDOW_AUTOSIZE);
while(1){
inicial = cvQueryFrame(camera);
if(render == 0){
system("cls");
render = 18;
printf("ESC -> Sair\n+------------------------------------------------------------+\n");
}
for(int i = 0 ; i < 2 ; i++){
c[i] = cvCreateMemStorage(0);
cort(inicial, img[i], c[i], structc[i], &x[i], &y[i]);
printf(" (%3.f,%3.f) ", x[i], y[i]);
if(i == 1){
printf("\n");
}
}
render--;
//_sleep(200);
cvShowImage("Vision", inicial); //IMAGEM MOSTRADA NA TELA, Inicial = Não tratada, img[i] = VETOR DAS CORES;
//cvShowImage("Vision[i]", img[i]);
if(cvWaitKey(33) == 27){
break;
}
}
cvReleaseCapture(&camera);
cvDestroyWindow("Vision");
return (0);
}