Skip to content

Commit

Permalink
Single capture object
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoaguilar committed Apr 28, 2015
1 parent d25fbb3 commit 96a1807
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions factory.c/factory.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@
using namespace cv;
using namespace std;

int detector(int x, int y, int width, int height, int thresholdValue);
int detector(int x, int y, int width, int height, int thresholdValue, CvCapture* capture);

int main(int argc, char const *argv[])
{
CvCapture* capture = cvCaptureFromCAM(0);
cvSetCaptureProperty(capture,CV_CAP_PROP_FRAME_WIDTH,640);
cvSetCaptureProperty(capture,CV_CAP_PROP_FRAME_HEIGHT,480);
wiringPiSetup();
pinMode(21,OUTPUT);
pinMode(20,OUTPUT);

digitalWrite(20,LOW); digitalWrite(21,LOW);
int DELAY_FOR_PIC = atoi(argv[1]);
int DELAY_FOR_ROBOT = atoi(argv[2]);
Expand All @@ -37,7 +41,7 @@ int main(int argc, char const *argv[])

//int resultado = detector(100, 80, 150, 150,140);
digitalWrite(20,LOW); digitalWrite(21,LOW);
int resultado = detector(x,y,width,height,thresholdValue);
int resultado = detector(x,y,width,height,thresholdValue, capture);
printf("%d\n", resultado);

if (resultado == LATA) {
Expand All @@ -59,17 +63,13 @@ int main(int argc, char const *argv[])
return 0;
}

int detector(int x, int y, int width, int height, int thresholdValue) {
int detector(int x, int y, int width, int height, int thresholdValue, CvCapture* capture) {

Mat img;
Rect r;
vector<Mat> channels;
r = Rect(x,y,width,height);

CvCapture* capture = cvCaptureFromCAM(0);
cvSetCaptureProperty(capture,CV_CAP_PROP_FRAME_WIDTH,640);
cvSetCaptureProperty(capture,CV_CAP_PROP_FRAME_HEIGHT,480);

if ( !capture ) {
fprintf( stderr, "ERROR: capture is NULL \n" );
getchar();
Expand Down

0 comments on commit 96a1807

Please sign in to comment.