Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
C/C++ - per compilare..
Forum - C/C++ - per compilare..

Avatar
feddur (Normal User)
Pro


Messaggi: 200
Iscritto: 06/03/2008

Segnala al moderatore
Postato alle 15:19
Lunedė, 20/10/2008
Salve, vorrei compilare questo codice:

http://www.hci.iastate.edu/575x/doku.php?id=tutorial2

Codice sorgente - presumibilmente Delphi

  1. // C++ includes.
  2. #include <iostream>
  3.  
  4. // OpenCV includes.
  5. #include <cv.h>
  6. #include <highgui.h>
  7.  
  8. void printCamResolution(CvCapture* camera)
  9. {
  10.         std::cout << std::endl;
  11.         std::cout << "Camera Capture Resolution:" << std::endl;
  12.         std::cout << "=================" << std::endl;
  13.         std::cout << "Video width: " << cvGetCaptureProperty(
  14.                 camera, CV_CAP_PROP_FRAME_WIDTH) << std::endl;
  15.         std::cout << "Video height: " << cvGetCaptureProperty(
  16.                 camera, CV_CAP_PROP_FRAME_HEIGHT) << std::endl;
  17.         std::cout << std::endl;
  18. }
  19.  
  20. int main(int argc, char* argv[])
  21. {
  22.         // Tell OpenCV to capture data from a camera.
  23.         CvCapture* camera = cvCaptureFromCAM(0);
  24.  
  25.         // Print the camera's properties.
  26.         printCamResolution(camera);
  27.  
  28.         // Create a window with the given name (displayed at the top of the
  29.         // window).  Also, we'll make it automatically resize to whatever content
  30.         // it displays.
  31.         cvNamedWindow("My Window", CV_WINDOW_AUTOSIZE);
  32.  
  33.         // Loop forever until the user quits.
  34.         while(1)
  35.         {
  36.                 // This will return the code of the pressed key or -1 if
  37.                 // nothing was pressed before 10 ms elapsed.
  38.                 int keyCode = cvWaitKey(10);
  39.  
  40.                 if ('c' == (char)keyCode)
  41.                 {
  42.                         // The user pressed 'c' (for 'capture').
  43.  
  44.                         // Get the latest image from the camera.  This
  45.                         // image should NOT be released manually.
  46.                         IplImage* image = cvQueryFrame(camera);
  47.  
  48.                         // Make the image show up in the named window.
  49.                         cvShowImage("My Window", image);
  50.  
  51.                         // Save the image to a file.
  52.                         static int imageCount = 0;
  53.                         char filename[32];
  54.                         sprintf(filename, "image%d.png", imageCount);
  55.                         cvSaveImage(filename, image);
  56.                         ++imageCount;
  57.                 }
  58.                 else if(keyCode >= 0)
  59.                 {
  60.                         // A non-capture key was pressed, so end the loop.
  61.                         break;
  62.                 }
  63.         }
  64.  
  65.         // Destroy the capture object and the window.
  66.         cvReleaseCapture(&camera);
  67.         cvDestroyWindow("My Window");
  68.  
  69.         return 0;
  70. }



solo che ho dei problemi nel trovare i file <cv.h>
e <highgui.h>
come posso fare?

PM Quote
Avatar
gioser (Normal User)
Pro


Messaggi: 111
Iscritto: 03/10/2008

Segnala al moderatore
Postato alle 16:43
Lunedė, 20/10/2008
devi scaricare la lireria OpenCV e i relativi file h

http://sourceforge.net/project/showfiles.php?group_id=22870

Ciao :)

PM Quote
Avatar
feddur (Normal User)
Pro


Messaggi: 200
Iscritto: 06/03/2008

Segnala al moderatore
Postato alle 19:25
Lunedė, 20/10/2008
fatto.. ma mi da questi errori...

Codice sorgente - presumibilmente Delphi

  1. Compilatore: Default compiler
  2. Building Makefile: "C:\Documents and Settings\Fede\Desktop\C++ includes\Makefile.win"
  3. Esecuzione di  make clean
  4. rm -f main.o  Progetto1.exe
  5.  
  6. g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include"  -I"C:/Dev-Cpp/include/c++/3.4.2/backward"  -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32"  -I"C:/Dev-Cpp/include/c++/3.4.2"  -I"C:/Dev-Cpp/include"  
  7.  
  8. main.cpp:5:16: cv.h: No such file or directory
  9.  
  10. main.cpp:6:21: highgui.h: No such file or directory
  11. main.cpp:8: error: stray '\4' in program
  12. main.cpp:8: error: expected init-declarator before numeric constant
  13. main.cpp:8: error: expected `,' or `;' before numeric constant
  14. main.cpp:8: error: expected constructor, destructor, or type conversion before '*' token
  15. main.cpp:8: error: expected `,' or `;' before '*' token
  16. main.cpp:13: error: stray '\4' in program
  17. main.cpp:15: error: stray '\4' in program
  18. main.cpp:20: error: stray '\4' in program
  19. main.cpp:20: error: expected init-declarator before numeric constant
  20. main.cpp:20: error: expected `,' or `;' before numeric constant
  21. main.cpp:20: error: expected unqualified-id before "char"
  22. main.cpp:20: error: expected `,' or `;' before "char"
  23. main.cpp:23: error: stray '\4' in program
  24. main.cpp:26: error: stray '\4' in program
  25. main.cpp:31: error: stray '\4' in program
  26.  
  27. main.cpp:34: error: stray '\4' in program
  28. main.cpp:38: error: stray '\4' in program
  29. main.cpp:40: error: stray '\4' in program
  30. main.cpp:40: error: stray '\4' in program
  31. main.cpp:46: error: stray '\4' in program
  32. main.cpp:49: error: stray '\4' in program
  33. main.cpp:54: error: stray '\4' in program
  34. main.cpp:55: error: stray '\4' in program
  35. main.cpp:58: error: stray '\4' in program
  36. main.cpp:66: error: stray '\4' in program
  37. main.cpp:67: error: stray '\4' in program
  38.  
  39. make.exe: *** [main.o] Error 1
  40.  
  41. Esecuzione terminata


Ultima modifica effettuata da feddur il 20/10/2008 alle 19:30
PM Quote
Avatar
gioser (Normal User)
Pro


Messaggi: 111
Iscritto: 03/10/2008

Segnala al moderatore
Postato alle 8:52
Martedė, 21/10/2008
devi dire al compilatore dove hai messo i file h in modo che possa trovarli. :)

PM Quote
Avatar
feddur (Normal User)
Pro


Messaggi: 200
Iscritto: 06/03/2008

Segnala al moderatore
Postato alle 19:50
Martedė, 21/10/2008
Testo quotato

Postato originariamente da gioser:

devi dire al compilatore dove hai messo i file h in modo che possa trovarli. :)



sė. li ho messi copme parametri.
uso DEV-C++
opzioni progetto -> parametri
ma non va.. :s

PM Quote
Avatar
munkaka (Member)
Pro


Messaggi: 119
Iscritto: 07/09/2008

Segnala al moderatore
Postato alle 7:22
Mercoledė, 22/10/2008
prova a copiarle nella stessa cartella dei file h di devc++

PM Quote