0

I try to make this Arduino Open CV tutorial for webcams. OpenCV 3.0 RC1 is compiled and installed. I also use Code::Blocks 13.12 as IDE. I am a newbie what comes to OpenCV and I do not know too much about Arduino either but here I am learning. Arduino IDE is 1.7.2. The tutorial is made for Windows 7 and software for this OS but I bet it is possible to repeat this in Ubuntu Linux 14.04 also.

So the tutorial is here:

http://duino4projects.com/face-detection-and-tracking-with-arduino-and-opencv/

When I try to compile and run the techbitarFaceDetection.cpp

the Code::Block IDE gives me following error:

fatal error: Tserial.h: No such file or directory

So please tell me what to do next and how to fix this error.

1

Forget Tserial.h lib. To solve your problem (for serial communication) I sugest you to use "read/write from/to a file" programming method. The serial ports may be written to just like you are writing in a file. In the facedetect.cpp (OpenCV's example), in the detectAndDraw() function (I'm using OpenCV 3.0) add: unsigned char MSB[1] = {0}; // unsigned char LSB[1] = {0}; // char serialPortFilename[]="/dev/ttyACM0"; FILE *serPort = fopen(serialPortFilename, "w"); //

than add:

LSB[0]=r->x & 0xff;//
    MSB[0]=(r->x >>8) & 0xff;//

    fwrite((const void*)MSB,sizeof(unsigned char),sizeof(MSB),serPort);//
fwrite((const void*)LSB,sizeof(unsigned char),sizeof(LSB),serPort);//

LSB[0]=r->y & 0xff;//
    MSB[0]=(r->y >>8) & 0xff;//

    fwrite((const void*)MSB,sizeof(unsigned char),sizeof(MSB),serPort);//
    fwrite((const void*)LSB,sizeof(unsigned char),sizeof(LSB),serPort);//

into the if (0.75 < aspect_ratio && aspect_ratio < 1.3) statement.

Finally don't forget to close the file

fclose(serPort);

Hope this will work for you!

0

TSerial.h is part of the Serial C++ Library that is used by the project that you are trying to build (see the section "Software Required" on the tutorial page you linked).

Make sure you have that library installed correctly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.