Difference between revisions of "Упражнение 11. Компютърно зрение"

From Ilianko
Line 4: Line 4:
  
 
1. Инсталирайте cmake
 
1. Инсталирайте cmake
sudo apt-get install cmake
+
sudo apt-get install cmake
  
 
2. Инсталирайте библиотеката libgtk2.0-dev
 
2. Инсталирайте библиотеката libgtk2.0-dev

Revision as of 06:12, 19 May 2011

Инсталация openCV

1. Инсталирайте cmake

sudo apt-get install cmake

2. Инсталирайте библиотеката libgtk2.0-dev

sudo apt-get install libgtk2.0-dev

3. да се свали openCV 2.2 и разархивирайте в директория Downloads/OpenCV-2.2.0

4. Влезте в директорията

cd Downloads/OpenCV-2.2.0
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ./
make
make install
export LD_LIBRARY_PATH=/home/lab/Downloads/OpenCV-2.2.0/lib:$LD_LIBRARY_PATH sudo ldconfig
-lopencv_core -lopencv_imgproc -lopencv_calib3d -lopencv_video -lopencv_features2d -lopencv_ml -lopencv_highgui -lopencv_objdetect -lopencv_contrib -lopencv_legacy



#include <opencv/highgui.h> //OpenCV GUI functions ̄include <stdio.h>
#include <opencv/cv.h>     //main OpenCV functions


int main(int argc, char** argv)
{
  CvCapture* c1 = cvCaptureFromCAM(0);
  IplImage* img = 0;
  
  
	   
  while(cvWaitKey(2) < 0)
  {
    cvGrabFrame( c1 );	
    img=cvRetrieveFrame(c1,0);
    cvShowImage( "c1", img);
  }
 
  //destroy the window
  cvReleaseCapture(&c1);
  return 0;
}


sinaptic manager apache2 http://localhost/

sudo chmod 777 /var/www/index.html sudo chmod 777 /var/www/

<img src="test.jpg" /> cvSaveImage("/var/www/test.jpg" ,img, 0);