�ܶ����Ҳ�����ô����,��ʵ֮ǰffmpeg����ͨ��cvs���أ�����������Ѿ������˸���ǿ���svn
���ʹ��SVN�����ﲻ�ٽ��ܣ����ϻ��д����İ�װ��ʹ�õ����¿��Խ������������м���SVN������������
SubVersion���� http://subversion.tigris.org/ ���أ�֧��linux�����������װ���
TortoiseSVN���� http://tortoisesvn.tigris.org/ ���أ��Ǻܲ�����SVN�ͻ��˳���Ϊwindows��dz��ɵ�windows��Դ���������ļ�����ϵͳ��Subversion�ͻ��ˣ��������ܷ��㣬commit������þ���Winrar�Ҽ�ѹ��һ�����㡣
ok����������װsubversion����ס���֮ǰװ��apr��apr-util����apache.org��վ���µ�
wget http://subversion.tigris.org/downloads/subversion-1.3.2.tar.gz
tar zvxf subversion-1.3.2.tar.gz
cd subversion-1.3.2
./configure --with-apr=/usr/local/apr-httpd --with-apr-util=/usr/local/apr-util-httpd/
make
make install
���ˣ����ǾͿ���ͨ��svn�����ȡ���µ�ffmpeg��
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
��ᷢ���������ڵ�Ŀ¼���Զ�����һ��ffmpeg��Ŀ¼�����������ص�Դ���롣
2.������ffmpeg�ı���
./configure --enable-libogg --enable-shared --enable-gpl
(һ��Ҫ���� --enable-shared,��ȻOpenCV�Ҳ���ffmpeg��)
================================================
2006-10-3
1.
���أ�opencv-0.9.9.tar.gz
http://puzzle.dl.sourceforge.net/sourceforge/opencvlibrary/opencv-0.9.9.tar.gz
2.
#tar -xzvf opencv-0.9.9.tar.gz
3.
#./configure --with-quicktime=no --with-ffmpeg
��OpenCVĬ����quicktime����Ƶ�ļ����Ұ����ij�ffmpeg)
4.
#make
5.
#make install
6.
�������
��/etc/ld.so.conf
����һ��/usr/local/lib
# ldconfig (root�û�)
Ȼ��/usr/local/lib/pkgconfig�е�opencv.pc ������/usr/lib/pkgconfig��,(��������ⲽ,�������벻��)
���Բ����������
# cp /usr/local/lib/pkgconfig/opencv.pc /usr/lib/pkgconfig
7.
�༭opencv����ķ���
�Ա༭cvtest.c�ļ�Ϊ����(��Ϊhighgui�в�����c++,����һ��Ҫ��g++����ſ���)
A. g++ `pkg-config --cflags opencv` -o cvtest cvtest.c `pkg-config --libs opencv`
B. ����: g++ `pkg-config --cflags opencv` -c cvtest.c
����: g++ `pkg-config --libs opencv` -o cvtest cvtest.o
=====================================================
2006-10-3
���ӣ�
/**************************************************
* ������ģ���˶�������
*
**************************************************/
/***********************************************************************
* OpenCV example
* Copyright (C) 2006 Shiqi Yu
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***********************************************************************/
#include
#include
#include
#include
int main( int argc, char** argv )
{
//����IplImageָ��
IplImage* pFrame = NULL;
IplImage* pFrImg = NULL;
IplImage* pBkImg = NULL;
CvMat* pFrameMat = NULL;
CvMat* pFrMat = NULL;
CvMat* pBkMat = NULL;
CvCapture* pCapture = NULL;
int nFrmNum = 0;
//��������
cvNamedWindow("video", 1);
cvNamedWindow("background",1);
cvNamedWindow("foreground",1);
//ʹ������������
cvMoveWindow("video", 30, 0);
cvMoveWindow("background", 360, 0);
cvMoveWindow("foreground", 690, 0);
if( argc != 2 )
{
fprintf(stderr, "Usage: bkgrd
return -1;
}
//����Ƶ�ļ�
if( !(pCapture = cvCreateFileCapture(argv[1])))
{
fprintf(stderr, "Can not open video file %s\n", argv[1]);
return -2;
}
//��֡��ȡ��Ƶ
while(pFrame = cvQueryFrame( pCapture ))
{
nFrmNum++;
//����ǵ�һ֡����Ҫ�����ڴ棬����ʼ��
if(nFrmNum == 1)
{
pBkImg = cvCreateImage(cvSize(pFrame->width, pFrame->height), IPL_DEPTH_8U,1);
pFrImg = cvCreateImage(cvSize(pFrame->width, pFrame->height), IPL_DEPTH_8U,1);
pBkMat = cvCreateMat(pFrame->height, pFrame->width, CV_32FC1);
pFrMat = cvCreateMat(pFrame->height, pFrame->width, CV_32FC1);
pFrameMat = cvCreateMat(pFrame->height, pFrame->width, CV_32FC1);
//ת���ɵ�ͨ��ͼ���ٴ���
cvCvtColor(pFrame, pBkImg, CV_BGR2GRAY);
cvCvtColor(pFrame, pFrImg, CV_BGR2GRAY);
cvConvert(pFrImg, pFrameMat);
cvConvert(pFrImg, pFrMat);
cvConvert(pFrImg, pBkMat);
}
else
{
cvCvtColor(pFrame, pFrImg, CV_BGR2GRAY);
cvConvert(pFrImg, pFrameMat);
//��˹�˲��ȣ���ƽ��ͼ��
//cvSmooth(pFrameMat, pFrameMat, CV_GAUSSIAN, 3, 0, 0);
//��ǰ֡������ͼ���
cvAbsDiff(pFrameMat, pBkMat, pFrMat);
//��ֵ��ǰ��ͼ
cvThreshold(pFrMat, pFrImg, 60, 255.0, CV_THRESH_BINARY);
//������̬ѧ�˲���ȥ������
//cvErode(pFrImg, pFrImg, 0, 1);
//cvDilate(pFrImg, pFrImg, 0, 1);
//���±���
cvRunningAvg(pFrameMat, pBkMat, 0.003, 0);
//������ת��Ϊͼ���ʽ��������ʾ
cvConvert(pBkMat, pBkImg);
//��ʾͼ��
cvShowImage("video", pFrame);
cvShowImage("background", pBkImg);
cvShowImage("foreground", pFrImg);
//����а����¼���������ѭ��
//�˵ȴ�ҲΪcvShowImage�����ṩʱ�������ʾ
//�ȴ�ʱ����Ը���CPU�ٶȵ���
if( cvWaitKey(2) >= 0 )
break;
}
}
//���ٴ���
cvDestroyWindow("video");
cvDestroyWindow("background");
cvDestroyWindow("foreground");
//�ͷ�ͼ��;���
cvReleaseImage(&pFrImg);
cvReleaseImage(&pBkImg);
cvReleaseMat(&pFrameMat);
cvReleaseMat(&pFrMat);
cvReleaseMat(&pBkMat);
return 0;
}